@bikdotai/bik-component-library 0.0.646-beta.6 → 0.0.646-beta.8
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/assets/icons/boxV2.svg.js +1 -0
- package/dist/cjs/assets/icons/help.svg.js +1 -0
- package/dist/cjs/assets/icons/openai.svg.js +1 -0
- package/dist/cjs/assets/icons/redirect.svg.js +1 -0
- package/dist/cjs/assets/icons/text_t9.svg.js +1 -0
- package/dist/cjs/assets/icons/website.svg.js +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +19 -0
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +23 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +3 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +123 -0
- package/dist/cjs/components/data-source-panel/index.d.ts +1 -0
- package/dist/cjs/components/data-source-panel/model.d.ts +135 -0
- package/dist/cjs/components/data-source-panel/model.js +1 -0
- package/dist/cjs/components/dropdown/ChipInput.d.ts +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.d.ts +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/input/Input.d.ts +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.styled.js +1 -1
- package/dist/cjs/components/modals/styledModal.d.ts +0 -1
- package/dist/cjs/components/modals/styledModal.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -5
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -13
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +14 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.d.ts +1 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.js +42 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +15 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.d.ts +1 -0
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +38 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/boxV2.svg.js +1 -0
- package/dist/esm/assets/icons/help.svg.js +1 -0
- package/dist/esm/assets/icons/openai.svg.js +1 -0
- package/dist/esm/assets/icons/redirect.svg.js +1 -0
- package/dist/esm/assets/icons/text_t9.svg.js +1 -0
- package/dist/esm/assets/icons/website.svg.js +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +19 -0
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +23 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +3 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +123 -0
- package/dist/esm/components/data-source-panel/index.d.ts +1 -0
- package/dist/esm/components/data-source-panel/model.d.ts +135 -0
- package/dist/esm/components/data-source-panel/model.js +1 -0
- package/dist/esm/components/dropdown/ChipInput.d.ts +1 -1
- package/dist/esm/components/dropdown/ChipInput.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.d.ts +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/input/Input.d.ts +1 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.styled.js +1 -1
- package/dist/esm/components/modals/styledModal.d.ts +0 -1
- package/dist/esm/components/modals/styledModal.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +1 -5
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +1 -13
- package/dist/esm/components/product-picker-v2/utility.js +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.d.ts +14 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.js +1 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.d.ts +1 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.js +42 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +15 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.d.ts +1 -0
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.js +38 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface MessageSource {
|
|
3
|
+
sources: InfoContent[];
|
|
4
|
+
intent: string;
|
|
5
|
+
messageId: string;
|
|
6
|
+
output_message_id?: string;
|
|
7
|
+
isUnsatisfactoryAnswer?: boolean;
|
|
8
|
+
isEditable?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface InfoContent {
|
|
11
|
+
title: string;
|
|
12
|
+
docId?: string;
|
|
13
|
+
subTitle?: string;
|
|
14
|
+
link?: string | string[];
|
|
15
|
+
type?: string;
|
|
16
|
+
intent?: string;
|
|
17
|
+
productId?: string;
|
|
18
|
+
variantId?: string;
|
|
19
|
+
imageUrl?: string;
|
|
20
|
+
isTrainable?: boolean;
|
|
21
|
+
subIntent?: string;
|
|
22
|
+
insights?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DataSourcePanelZeroState {
|
|
25
|
+
title: string;
|
|
26
|
+
leadingIcon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
|
|
27
|
+
onClick: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface AllSourceInfoDetailsCustomDataModel {
|
|
30
|
+
[keys: string]: SourceInfoDetailsCustomDataModel;
|
|
31
|
+
}
|
|
32
|
+
export interface SourceInfoDetailsCustomDataModel {
|
|
33
|
+
storeId: string;
|
|
34
|
+
type: CustomDataType;
|
|
35
|
+
data: FileMetaData | CustomDataDocument | CustomDataFaqModel;
|
|
36
|
+
content?: string;
|
|
37
|
+
docId: string;
|
|
38
|
+
onEditClick: (item: FileMetaData | CustomDataDocument | CustomDataFaqModel, type: string) => void;
|
|
39
|
+
redirect?: (source: InfoContent) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare enum CustomDataCategories {
|
|
42
|
+
PAGE = "page",
|
|
43
|
+
POLICY = "policy",
|
|
44
|
+
ARTICLE = "article",
|
|
45
|
+
UPLOADED = "uploaded",
|
|
46
|
+
TEXT = "text"
|
|
47
|
+
}
|
|
48
|
+
export type CustomDataCategory = keyof typeof CustomDataCategories;
|
|
49
|
+
export declare enum CustomDataType {
|
|
50
|
+
FAQ = "FAQ",
|
|
51
|
+
FILES = "FILES",
|
|
52
|
+
WEBSITE_LINKS = "WEBSITE_LINKS",
|
|
53
|
+
TEXTS = "TEXTS",
|
|
54
|
+
FETCHED_LINKS = "FETCHED_LINKS",
|
|
55
|
+
URL = "URL",
|
|
56
|
+
TRAINING_TEMPLATE = "TRAINING_TEMPLATE"
|
|
57
|
+
}
|
|
58
|
+
export interface FileMetaData {
|
|
59
|
+
fileId: string;
|
|
60
|
+
fileName: string;
|
|
61
|
+
fileSize: string;
|
|
62
|
+
fileType: string;
|
|
63
|
+
fileUrl: string;
|
|
64
|
+
uploadType: 'URL' | 'FileUpload';
|
|
65
|
+
uploadDate: Date;
|
|
66
|
+
characterCount?: number;
|
|
67
|
+
intent?: string;
|
|
68
|
+
fileContent?: string;
|
|
69
|
+
fileContentPath?: string;
|
|
70
|
+
fileContentText?: string;
|
|
71
|
+
isActive?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface CustomDataDocument {
|
|
74
|
+
category: CustomDataCategory;
|
|
75
|
+
id: string;
|
|
76
|
+
handle?: string;
|
|
77
|
+
title?: string;
|
|
78
|
+
createdAt?: Date;
|
|
79
|
+
updatedAt?: Date;
|
|
80
|
+
url?: string;
|
|
81
|
+
isActive?: boolean;
|
|
82
|
+
characterCount?: number;
|
|
83
|
+
intent?: string;
|
|
84
|
+
wasManualLinkAdded?: boolean;
|
|
85
|
+
fileContent?: string;
|
|
86
|
+
fileContentText?: string;
|
|
87
|
+
fileId?: string;
|
|
88
|
+
fileContentPath?: string;
|
|
89
|
+
fileName?: string;
|
|
90
|
+
lastEditedAt?: number;
|
|
91
|
+
}
|
|
92
|
+
export interface CustomDataFaqModel {
|
|
93
|
+
id: string;
|
|
94
|
+
question: string;
|
|
95
|
+
answer: string;
|
|
96
|
+
createdAt: Date;
|
|
97
|
+
updatedAt?: Date;
|
|
98
|
+
questionSpecificProducts?: Array<FaqProductModel>;
|
|
99
|
+
products?: Array<FaqProductModel>;
|
|
100
|
+
cta?: Array<LiveChatCTA>;
|
|
101
|
+
intent?: string;
|
|
102
|
+
crmNoteMeta?: CRMNoteMeta;
|
|
103
|
+
fromEditResponse?: boolean;
|
|
104
|
+
isTemplateFAQ?: boolean;
|
|
105
|
+
isSatisfactoryAnswer?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface FaqProductModel {
|
|
108
|
+
id: string;
|
|
109
|
+
variantId: string;
|
|
110
|
+
name: string;
|
|
111
|
+
imageUrl: string;
|
|
112
|
+
}
|
|
113
|
+
export interface CRMNoteMeta {
|
|
114
|
+
createdAt: Date;
|
|
115
|
+
sessionId: string;
|
|
116
|
+
userId: number;
|
|
117
|
+
messageId: string;
|
|
118
|
+
customerId: string;
|
|
119
|
+
updatedAt: Date;
|
|
120
|
+
}
|
|
121
|
+
export interface LiveChatCTA {
|
|
122
|
+
url: string;
|
|
123
|
+
cta: string;
|
|
124
|
+
buttonType: string;
|
|
125
|
+
}
|
|
126
|
+
export interface footerButtonOptionModel {
|
|
127
|
+
title?: string;
|
|
128
|
+
subtitle?: string;
|
|
129
|
+
buttonTitle: string;
|
|
130
|
+
addFaqProps?: any;
|
|
131
|
+
redirectUrl?: string;
|
|
132
|
+
hideAddDataButton?: boolean;
|
|
133
|
+
navigate?: (pagePathKey: Record<string, string>, params?: object, queryParam?: object, openInNewTab?: boolean) => void;
|
|
134
|
+
onClick: () => void;
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E,T;!function(E){E.PAGE="page",E.POLICY="policy",E.ARTICLE="article",E.UPLOADED="uploaded",E.TEXT="text"}(E||(E={})),function(E){E.FAQ="FAQ",E.FILES="FILES",E.WEBSITE_LINKS="WEBSITE_LINKS",E.TEXTS="TEXTS",E.FETCHED_LINKS="FETCHED_LINKS",E.URL="URL",E.TRAINING_TEMPLATE="TRAINING_TEMPLATE"}(T||(T={}));export{E as CustomDataCategories,T as CustomDataType};
|
|
@@ -6,7 +6,7 @@ interface ChipInputProps {
|
|
|
6
6
|
onDeleteChip: (chip: SingleOption) => void;
|
|
7
7
|
containerStyle?: React.CSSProperties;
|
|
8
8
|
isDropdownOpened?: boolean;
|
|
9
|
-
sizeToUse?: 'default' | 'small'
|
|
9
|
+
sizeToUse?: 'default' | 'small';
|
|
10
10
|
}
|
|
11
11
|
declare const ChipInput: React.FC<ChipInputProps>;
|
|
12
12
|
export default ChipInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useEffect as s}from"react";import r from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import n from"../../assets/icons/chevronDown.svg.js";import i from"../../assets/icons/cross.svg.js";import{Tag as c}from"../tag/Tag.js";import{BodyCaption as a}from"../TypographyStyle.js";import{ChipInputWrapper as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useEffect as s}from"react";import r from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import n from"../../assets/icons/chevronDown.svg.js";import i from"../../assets/icons/cross.svg.js";import{Tag as c}from"../tag/Tag.js";import{BodyCaption as a}from"../TypographyStyle.js";import{ChipInputWrapper as h}from"./Common.styled.js";const m=m=>{let{chips:d,onDeleteChip:g,containerStyle:p={},sizeToUse:j="default",isDropdownOpened:f,placeholder:b="Select.."}=m;const[y,u]=l(),[v,O]=l(0);return s((()=>{if(!d)return;let e=0;const t=(e=>1===e.length?100:2===e.length?40:34)(d);let l=d.filter((l=>(e+=l.label.length,e<=t)));0===l.length&&d.length>0&&(l=[d[0]]),u(l),O(d.length-l.length)}),[d]),e(h,Object.assign({style:Object.assign({},p)},{children:[e("div",Object.assign({className:"chips-container"},{children:[null==y?void 0:y.map(((e,l)=>t("div",Object.assign({style:{zIndex:2}},{children:t(c,Object.assign({tagText:r.truncateText(e.selectedLabel||e.label,40),TrailingIcon:()=>t(i,{width:12,height:12,style:{cursor:"pointer"},onClick:()=>{g(e)}})},{children:e.selectedLabel||e.label}))}),l))),!!v&&t(a,Object.assign({color:o.content.placeholder},{children:`+${v} more`})),0===d.length&&t("div",Object.assign({style:{color:o.content.placeholder}},{children:b}))]})),t("div",{children:t(n,{style:{transform:f?"rotate(180deg)":"rotate(0deg)"},width:"small"===j?20:24,height:"small"===j?20:24,color:o.content.primary})})]}))};export{m as default};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { OpenDropdownProps, SingleOption } from './type';
|
|
3
3
|
export type DropdownProps = OpenDropdownProps & {
|
|
4
4
|
placeHolder?: string;
|
|
5
|
-
size?: 'default' | 'small'
|
|
5
|
+
size?: 'default' | 'small';
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
noErrorHint?: boolean;
|
|
8
8
|
buttonWidth?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r}from"react";import{COLORS as s}from"../../constants/Theme.js";import d from"../../assets/icons/chevronDown.svg.js";import{Input as a}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import c from"./ChipInput.js";import{DropdownPopover as u}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as h}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const v=v=>{var f,g,w,b,j,{placeHolder:I,size:y,onSelect:x,defaultOptions:O,disabled:S,noErrorHint:H,placeHolderHeight:D,showPlaceholderWhenSelected:T=!1,inputStyle:C={},inputType:P="default",onDeleteChip:E,truncatedText:z,showLeadingIconInPlaceholder:W=!1}=v,A=e(v,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder"]);const[L,_]=i(!1),k=null!=y?y:"default",M=l(),[N,U]=i(null!=O?O:[]);r((()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),U([...o])}),[A.options]),r((()=>{O&&U([...O])}),[O]);const V=h(N);return o(p.Provider,Object.assign({value:{InputWrapper:Object.assign({height:D||("small"===k?32:48),width:null!==(g=null!==(f=A.buttonWidth)&&void 0!==f?f:A.width)&&void 0!==g?g:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},C),input:{minHeight:"100%"}}},{children:t(u,Object.assign({"data-test":A["data-test"],ref:M,onSelect:function(e){Array.isArray(e)?U([...e]):U([e]),null==x||x(e)},disabled:S,onDropdownVisbilityChange:e=>_(e)},A,{children:["default"==P&&o(a,{version:A.version,noErrorHint:H,state:S?"disabled":"none",value:T?I:null!=V?V:"",errorMessage:A.error,variant:k,placeholder:null!=I?I:"Select an option",width:null!==(w=A.width)&&void 0!==w?w:"100%",onChangeText:m,leftIcon:W&&(null===(b=N[0])||void 0===b?void 0:b.leadingIcon)?{icon:()=>{var e;return o(n,{children:null===(e=N[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>o(d,{style:{transform:L?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"small"===k?20:24,height:"small"===k?20:24,color:s.content.primary})},truncateText:null==z||z}),"chip"==P&&o(c,{placeholder:null!=I?I:"Select options",chips:N,onDeleteChip:e=>{null==E||E(e)},isDropdownOpened:L,sizeToUse:k,containerStyle:{width:null!==(j=A.width)&&void 0!==j?j:"100%",cursor:"pointer"}})]}))}))};v.displayName="Dropdown";export{v as Dropdown};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../button/model';
|
|
3
|
-
export type InputVariant = 'default' | 'small'
|
|
3
|
+
export type InputVariant = 'default' | 'small';
|
|
4
4
|
export type InputStateI = 'invalid' | 'active' | 'read-only' | 'disabled' | 'disabled-invalid' | 'none';
|
|
5
5
|
export type InputTypeI = 'number' | 'email' | 'text' | 'multiline' | 'url' | 'zip' | 'phonenumber' | 'password';
|
|
6
6
|
export interface InputProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as t,jsx as e,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 h,validateInput as u}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 C,PrefixHolder as O,InputContainer as T,InputContainerSmall as w,SuffixHolder as I,InputHeader as k}from"./Input.styled.js";const L=l(((l,L)=>{var H,B,E,M,P,D,S;const{placeholder:z,leftIcon:A,rightIcon:F,labelText:K,maxCharLimit:N,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:tt,noKeyDownChange:et,version:nt,noMaxCharCheck:it,labelElement:lt,autoGrow:rt,minHeight:ot,maxHeight:at,labelTextBold:st,truncateText:ct,maxCharLimitPosition:ht,hightlightInputColor:ut,onKeyDownEvent:dt,hideInputHeader:vt}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),pt=null==A?void 0:A.icon,gt=null==F?void 0:F.icon,[mt,bt]=r(!1),[ft,xt]=r(!1),[yt,jt]=r(),Ct="small"===W?"18px":"22px",Ot=o(b),[Tt,wt]=r(),It=a(null),kt=null!=L?L:It;s((()=>{wt(X),!X&&rt&&(kt.current.style.height=ot||"48px")}),[X]),s((()=>{var t;kt.current&&(null===(t=l.onReferenceInit)||void 0===t||t.call(l,kt.current))}),[kt]),s((()=>{const t=kt.current;if(t&&["phonenumber","zip","number"].includes(_))return t.addEventListener("wheel",Et,{passive:!1}),()=>{t.removeEventListener("wheel",Et)}}),[]),s((()=>{Z&&wt("")}),[Z]),s((()=>{var t;xt(!!l.isActive),l.isActive&&(null===(t=kt.current)||void 0===t||t.focus())}),[l.isActive]),s((()=>{jt(l.errorMessage)}),[l.errorMessage]),s((()=>{var t;bt(!1),("invalid"===l.state||yt||"disabled-invalid"===l.state)&&bt(!0),"active"===l.state&&(null===(t=kt.current)||void 0===t||t.focus())}),[l.state,yt]),s((()=>{bt(!!yt||"invalid"===l.state)}),[yt,l.state]);const Lt=function(t){if(h(t)){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];t(...n)}},Ht=()=>"zip"===_?6:2e3,Bt=t=>{const e=0!==N?N:Ht();if(dt&&dt(t),et||U(X||"",t),it)return;const n=t.target.value;![8].includes(t.which)&&e>0&&n.length>=e&&t.preventDefault()},Et=t=>{t.preventDefault()},Mt=t=>{let e=t.target.value;const n=0!==N?N+1:Ht();!it&&n>0&&e.length>=n&&(e=e.substring(0,n-1)),U(e,t),l.textControl||wt(e),rt&&(kt.current.style.height=`${kt.current.scrollHeight}px`,e||(kt.current.style.height=ot||"48px"));const i=V||u;if(!i||!h(i))return;const[r,o]=i(e,_,tt);bt(!r),jt(l.errorMessage?l.errorMessage:o)},Pt=t=>{var e;l.skipFocus||xt(!0),Lt(null===(e=l.onFocus)||void 0===e?void 0:e.call(l,t))},Dt=t=>{var e;l.skipFocus||xt(!1),Lt(null===(e=l.onBlur)||void 0===e?void 0:e.call(l,t))},St=()=>{var i;return t(n,{children:["multiline"!==_&&e("input",{className:ct?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(i=null==Ot?void 0:Ot.input)&&void 0!==i?i:{},ref:kt,type:["phonenumber","zip","number"].includes(_)?"number":_,value:Tt,onFocus:t=>Pt(t),onBlur:t=>Dt(t),placeholder:z||"Enter here",onChange:Mt,onClick:t=>Lt(l.onClick),onKeyDown:t=>Bt(t)}),"multiline"===_&&e("textarea",{"data-test":l["data-test"],value:Tt,ref:kt,onFocus:t=>Pt(t),onBlur:t=>Dt(t),onClick:t=>Lt(l.onClick),placeholder:z||"Enter here",onChange:Mt,onKeyDown:t=>Bt(t),maxLength:N>0?N:void 0})]})};return t(f,Object.assign({width:l.width,height:l.height,state:q,type:_,style:null!==(H=null==Ot?void 0:Ot.RootContainer)&&void 0!==H?H:{}},{children:[t("div",Object.assign({className:"flex-align-center"},{children:[!Y&&(!!G||!!yt)&&t(x,Object.assign({invalid:!!yt},{children:[!!yt&&e(m,{width:16,height:16}),yt||G]})),N>0&&"BOTTOM"===ht&&t(y,Object.assign({position:"BOTTOM"},{children:[null!==(E=null===(B=(null!=X?X:"").toString())||void 0===B?void 0:B.length)&&void 0!==E?E:0,"/",N]}))]})),t(j,Object.assign({variant:W,state:q,width:l.width,isActive:"active"===q||ft,isInvalid:mt,style:null!==(M=null==Ot?void 0:Ot.InputWrapper)&&void 0!==M?M:{},version:nt,height:l.height,hightlightInputColor:ut},{children:[!!pt&&e(C,Object.assign({variant:W,iconSize:Ct,onClick:()=>Lt(null==A?void 0:A.callback),isLeft:!0,style:null!==(P=null==Ot?void 0:Ot.IconHolder)&&void 0!==P?P:{}},{children:e(pt,{})})),!!Q&&e(O,Object.assign({variant:W},{children:Q})),"default"===W&&e(T,Object.assign({height:l.height,type:l.type,minHeight:ot,maxHeight:at,autoGrow:rt},{children:St()})),"small"===W&&e(w,Object.assign({height:l.height,type:l.type},{children:St()})),!!gt&&e(C,Object.assign({variant:W,iconSize:Ct,onClick:()=>Lt(null==F?void 0:F.callback),isLeft:!1},{children:e(gt,{})})),!!J&&e(I,Object.assign({variant:W},{children:J})),$&&$.text&&e(c,{buttonText:$.text,onClick:()=>Lt(null==$?void 0:$.onClick)}),$&&$.buttonProps&&e(c,Object.assign({},$.buttonProps))]})),!vt&&(!!K||!!N)&&t(k,Object.assign({invalid:mt},{children:[lt&<,t("div",Object.assign({className:"label__container"},{children:[t(st?v:p,{children:[K,R?e("span",{children:"*"}):""]}),l.tooltipText&&e(d,Object.assign({body:l.tooltipText,placement:"top"},{children:e("span",{children:e(i,{style:{marginTop:-3},width:18,height:18,color:mt?g.content.negative:g.content.primary})})}))]})),N>0&&"TOP"===ht&&t(y,{children:[null!==(S=null===(D=(null!=X?X:"").toString())||void 0===D?void 0:D.length)&&void 0!==S?S:0,"/",N]})]}))]}))}));L.displayName="Input";export{L as Input};
|