@bikdotai/bik-component-library 0.0.38 → 0.0.39
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/searchIcon.d.ts +2 -0
- package/dist/cjs/components/QueryBuilder/components/AllowedListDropdown.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/searchBar/index.d.ts +1 -0
- package/dist/cjs/components/searchBar/searchBar.d.ts +11 -0
- package/dist/cjs/components/stepper/WorkingStepper.d.ts +0 -1
- package/dist/esm/assets/icons/searchIcon.d.ts +2 -0
- package/dist/esm/components/QueryBuilder/components/AllowedListDropdown.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js +1 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/searchBar/index.d.ts +1 -0
- package/dist/esm/components/searchBar/searchBar.d.ts +11 -0
- package/dist/esm/components/stepper/WorkingStepper.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../types/QueryBuilder.type.js"),l=require("./DropdownWrapper.js");const u={[r.QueryBuilderType.EVENT_FILTER]:{label:"Performed event",value:r.QueryBuilderType.EVENT_FILTER},[r.QueryBuilderType.NO_EVENT_FILTER]:{label:"Didn’t perform event",value:r.QueryBuilderType.NO_EVENT_FILTER},[r.QueryBuilderType.USER_PROPERTY_FILTER]:{label:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../types/QueryBuilder.type.js"),l=require("./DropdownWrapper.js");const u={[r.QueryBuilderType.EVENT_FILTER]:{label:"Performed event",value:r.QueryBuilderType.EVENT_FILTER},[r.QueryBuilderType.NO_EVENT_FILTER]:{label:"Didn’t perform event",value:r.QueryBuilderType.NO_EVENT_FILTER},[r.QueryBuilderType.USER_PROPERTY_FILTER]:{label:"Have user property",value:r.QueryBuilderType.USER_PROPERTY_FILTER},[r.QueryBuilderType.SEGMENT_FILTER]:{label:"Part of segment",value:r.QueryBuilderType.SEGMENT_FILTER}};exports.QUERY_TYPE_TO_OPTION_MAP=u,exports.default=r=>{let{allowedList:t,onSelect:i,selectedType:d,loading:a,disabled:T}=r;const s=t.map((e=>{var r;return null!==(r=u[e])&&void 0!==r?r:null})).filter((e=>e)).map((e=>{var r;if(d)return(null==e?void 0:e.value)===(null===(r=u[d])||void 0===r?void 0:r.value)?Object.assign(Object.assign({},e),{selected:!0}):e}));return e.jsx(l.default,{disabled:T,width:"200px",isLoading:null!=a&&a,options:s,onSelect:i})};
|
package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("../../../constants/connectorPosition.js"),n=require("../../../helpers/ApiResponse.helper.js"),t=require("../../Connectors/Connector.js"),a=require("../../DropdownWrapper.js"),i=require("./PropertyNode.styled.js"),l=require("./PropertyNodeUIWrapper.js");const s=new n.ApiResponseHelper,d=n=>{let{propertySelectorText:l,fetchPropertyData:d,onPropertyNameSelect:u,onPropertyOperatorChange:p,onPropertyValueChange:c,property:v,mode:y}=n;var j,f,g,h,m,x,b;const[A,C]=r.useState([]),[O,P]=r.useState({}),[w,S]=r.useState(!0),[q,L]=r.useState("create"===y),T=Array.isArray(A)?A.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==v?void 0:v.name)===e.id}))):s.convertToGroupOptions(A,(null==v?void 0:v.name)?[v.name.toString()]:void 0);function N(e){if(!Array.isArray(e)){L(!0);let r=null;Array.isArray(A)?r=A.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(A).forEach((o=>{const n=A[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),P({}),r?null==u||u(r,v).then((e=>{P({options:Array.isArray(e)?[...e]:Object.assign({},e)}),L(!1)})):L(!1)}}return r.useEffect((()=>{d?d().then((e=>{e&&(Array.isArray(e)?C([...e]):C(Object.assign({},e))),S(!1)})):S(!1)}),[]),r.useEffect((()=>{if("create"!==y&&Array.isArray(A)){const e=A.find((e=>e.id===(null==v?void 0:v.name))),r=v;e&&N({value:e.id,label:e.name}),null==c||c(null==r?void 0:r.value,v)}}),[A]),e.jsxs(e.Fragment,{children:[e.jsxs(i.Container,{children:[e.jsx(a.default,{disabled:"view"===y,width:"200px",isLoading:w,dropdownLabel:null!=l?l:"Select property",options:T,onSelect:N,error:null===(j=null==v?void 0:v.error)||void 0===j?void 0:j.name}),(null==v?void 0:v.name)&&!(null===(f=o.isNewLineConnectorPosition[v.dataType])||void 0===f?void 0:f[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(g=v.error)||void 0===g?void 0:g.value,operator:null===(h=v.error)||void 0===h?void 0:h.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>{null==p||p(e,v)},onValueChange:e=>null==c?void 0:c(e,v)})]}),(null==v?void 0:v.name)&&(null===(m=o.isNewLineConnectorPosition[v.dataType])||void 0===m?void 0:m[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(x=v.error)||void 0===x?void 0:x.value,operator:null===(b=v.error)||void 0===b?void 0:b.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>null==p?void 0:p(e,v),onValueChange:e=>null==c?void 0:c(e,v)})]})};exports.PropertyNode=r=>e.jsx(l.default,Object.assign({isLast:r.isLast,mode:r.mode},{children:e.jsx("div",Object.assign({style:{padding:12}},{children:e.jsx(d,Object.assign({},r))}))})),exports.PropertyNodeHeadless=d;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("../../../constants/connectorPosition.js"),n=require("../../../helpers/ApiResponse.helper.js"),t=require("../../Connectors/Connector.js"),a=require("../../DropdownWrapper.js"),i=require("./PropertyNode.styled.js"),l=require("./PropertyNodeUIWrapper.js");const s=new n.ApiResponseHelper,d=n=>{let{propertySelectorText:l,fetchPropertyData:d,onPropertyNameSelect:u,onPropertyOperatorChange:p,onPropertyValueChange:c,property:v,mode:y}=n;var j,f,g,h,m,x,b;const[A,C]=r.useState([]),[O,P]=r.useState({}),[w,S]=r.useState(!0),[q,L]=r.useState("create"===y),T=Array.isArray(A)?A.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==v?void 0:v.name)===e.id}))):s.convertToGroupOptions(A,(null==v?void 0:v.name)?[v.name.toString()]:void 0);function N(e){if(!Array.isArray(e)){L(!0);let r=null;Array.isArray(A)?r=A.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(A).forEach((o=>{const n=A[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),P({}),r?null==u||u(r,v).then((e=>{P({options:Array.isArray(e)?[...e]:Object.assign({},e)}),L(!1)})):L(!1)}}return r.useEffect((()=>{d?d().then((e=>{e&&(Array.isArray(e)?C([...e]):C(Object.assign({},e))),S(!1),L(!1)})):(S(!1),L(!1))}),[]),r.useEffect((()=>{if("create"!==y&&Array.isArray(A)){const e=A.find((e=>e.id===(null==v?void 0:v.name))),r=v;e&&N({value:e.id,label:e.name}),null==c||c(null==r?void 0:r.value,v)}}),[A]),e.jsxs(e.Fragment,{children:[e.jsxs(i.Container,{children:[e.jsx(a.default,{disabled:"view"===y,width:"200px",isLoading:w,dropdownLabel:null!=l?l:"Select property",options:T,onSelect:N,error:null===(j=null==v?void 0:v.error)||void 0===j?void 0:j.name}),(null==v?void 0:v.name)&&!(null===(f=o.isNewLineConnectorPosition[v.dataType])||void 0===f?void 0:f[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(g=v.error)||void 0===g?void 0:g.value,operator:null===(h=v.error)||void 0===h?void 0:h.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>{null==p||p(e,v)},onValueChange:e=>null==c?void 0:c(e,v)})]}),(null==v?void 0:v.name)&&(null===(m=o.isNewLineConnectorPosition[v.dataType])||void 0===m?void 0:m[v.operator])&&e.jsx(t.default,{isLoading:q,disabled:"view"===y,extra:O,errors:{val:null===(x=v.error)||void 0===x?void 0:x.value,operator:null===(b=v.error)||void 0===b?void 0:b.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>null==p?void 0:p(e,v),onValueChange:e=>null==c?void 0:c(e,v)})]})};exports.PropertyNode=r=>e.jsx(l.default,Object.assign({isLast:r.isLast,mode:r.mode},{children:e.jsx("div",Object.assign({style:{padding:12}},{children:e.jsx(d,Object.assign({},r))}))})),exports.PropertyNodeHeadless=d;
|
package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("../../../../dropdown/Dropdown.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),t=require("../../../../dropdown/Dropdown.js"),o=require("../../../constants/operators.js"),i=require("../../../types/QueryBuilder.type.js"),s=require("../../DeleteButton.js"),d=require("./AddPropertyButton.js"),l=require("./PropertyNode.js"),n=require("./PropertyNodeUIWrapper.styled.js");exports.default=p=>{var a,u,{node:c,addPropertyBtnText:j,deleteProperty:y,createProperty:v,selectPropertyJoinOperator:x,mode:O}=p,P=e.__rest(p,["node","addPropertyBtnText","deleteProperty","createProperty","selectPropertyJoinOperator","mode"]);const _=o.JOIN_OPERATOR_OPTIONS.map((e=>{if(c.PropertyOperator){if(e.value===c.PropertyOperator)return Object.assign(Object.assign({},e),{selected:!0})}else if(e.value===i.QueryBuilderJoinOperators.AND)return Object.assign(Object.assign({},e),{selected:!0});return e}));return r.jsxs(r.Fragment,{children:[null===(a=null==c?void 0:c.properties)||void 0===a?void 0:a.map(((e,o)=>r.jsxs(r.Fragment,{children:[0!==o&&r.jsx("div",Object.assign({style:{width:80,position:"relative"}},{children:r.jsx(t.Dropdown,{disabled:"view"===O,onSelect:e=>{null==x||x(e.value,c._id)},options:_,width:"80px",height:96,size:"small"},`${o}-operator-selector`)}),`${o}-operator`),r.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[r.jsx(l.PropertyNode,Object.assign({isLast:!!c.properties&&o===c.properties.length-1,property:e},P,{mode:O}),`${e._id}-property-node`),"view"!==O&&r.jsx(s.default,{onClick:()=>y(e,c._id)},`${e._id}-${o}-delete-btn`)]}),e._id)]}))),"view"!==O&&r.jsxs("div",{children:[0===(null===(u=null==c?void 0:c.properties)||void 0===u?void 0:u.length)&&r.jsx("div",{children:r.jsx(n.Line,{})}),r.jsx(d.default,{buttonText:null!=j?j:"Add Property",onClick:()=>v({},c._id)})]})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("../TypographyStyle.js"),r=require("../../assets/icons/errorInfo.svg.js"),l=require("./context/InputStyleProvider.js"),s=require("./Input.styled.js");const a=e=>e&&"function"==typeof e,o=t.forwardRef(((o,u)=>{var c,d,v,x;const{placeholder:h,leftIcon:j,rightIcon:p,labelText:f,maxCharLimit:g,isRequired:y,hintText:I,type:b,state:C,validate:m,variant:S,button:w,suffixText:O,prefixText:q,onChangeText:E,value:H,noErrorHint:T}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),k=null==j?void 0:j.icon,B=null==p?void 0:p.icon,[F,A]=t.useState(!1),[L,M]=t.useState(!1),[R,D]=t.useState(),P="small"===S?"18px":"22px",z=t.useContext(l.InputStyleContext);t.useEffect((()=>{M(!!o.isActive)}),[o.isActive]),t.useEffect((()=>{D(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{A(!1),("invalid"===o.state||R)&&A(!0)}),[o.state,R]),t.useEffect((()=>{A(!!R)}),[R]);const K=function(e){if(a(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)}},W=e=>{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("../TypographyStyle.js"),r=require("../../assets/icons/errorInfo.svg.js"),l=require("./context/InputStyleProvider.js"),s=require("./Input.styled.js");const a=e=>e&&"function"==typeof e,o=t.forwardRef(((o,u)=>{var c,d,v,x;const{placeholder:h,leftIcon:j,rightIcon:p,labelText:f,maxCharLimit:g,isRequired:y,hintText:I,type:b,state:C,validate:m,variant:S,button:w,suffixText:O,prefixText:q,onChangeText:E,value:H,noErrorHint:T}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),k=null==j?void 0:j.icon,B=null==p?void 0:p.icon,[F,A]=t.useState(!1),[L,M]=t.useState(!1),[R,D]=t.useState(),P="small"===S?"18px":"22px",z=t.useContext(l.InputStyleContext);t.useEffect((()=>{M(!!o.isActive)}),[o.isActive]),t.useEffect((()=>{D(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{A(!1),("invalid"===o.state||R)&&A(!0)}),[o.state,R]),t.useEffect((()=>{A(!!R)}),[R]);const K=function(e){if(a(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)}},W=e=>{E(H||"",e),![8].includes(e.which)&&g>0&&e.target.value.length===g&&e.preventDefault()},_=e=>{const t=e.target.value;if(E(t,e),!m||!a(m))return;const[n,i]=m(t);A(!n),D(i)},N=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==b&&e.jsx("input",{id:o.id,style:null!==(t=null==z?void 0:z.input)&&void 0!==t?t:{},ref:u,type:b,value:H,onFocus:()=>(M(!0),void K(o.onFocus)),onBlur:e=>(e=>{var t;M(!1),K(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:h||"Enter here",onChange:_,onKeyDown:e=>W(e)}),"multiline"===b&&e.jsx("textarea",{value:H,ref:u,onFocus:()=>M(!0),onBlur:()=>M(!1),placeholder:h||"Enter here",onChange:_,onKeyDown:e=>W(e)})]})};return e.jsxs(s.RootContainer,Object.assign({width:o.width,height:o.height,state:C,type:b,style:null!==(c=null==z?void 0:z.RootContainer)&&void 0!==c?c:{}},{children:[!T&&(!!I||!!R)&&e.jsxs(s.InputFooter,Object.assign({invalid:!!R},{children:[!!R&&e.jsx(r.default,{width:16,height:16}),R||I]})),e.jsxs(s.InputWrapper,Object.assign({variant:S,state:C,width:o.width,isActive:"active"===C||L,isInvalid:F,style:null!==(d=null==z?void 0:z.InputWrapper)&&void 0!==d?d:{}},{children:[!!k&&e.jsx(s.IconHolder,Object.assign({variant:S,iconSize:P,onClick:()=>K(null==j?void 0:j.callback),isLeft:!0,style:null!==(v=null==z?void 0:z.IconHolder)&&void 0!==v?v:{}},{children:e.jsx(k,{})})),!!q&&e.jsx(s.PrefixHolder,Object.assign({variant:S},{children:q})),"default"===S&&e.jsx(s.InputContainer,{children:N()}),"small"===S&&e.jsx(s.InputContainerSmall,{children:N()}),!!B&&e.jsx(s.IconHolder,Object.assign({variant:S,iconSize:P,onClick:()=>K(null==p?void 0:p.callback),isLeft:!1},{children:e.jsx(B,{})})),!!O&&e.jsx(s.SuffixHolder,Object.assign({variant:S},{children:O})),w&&w.text&&e.jsx(n.Button,{buttonText:w.text,onClick:()=>K(null==w?void 0:w.onClick)})]})),(!!f||!!g)&&"default"===S&&e.jsxs(s.InputHeader,Object.assign({invalid:F},{children:[e.jsxs(i.BodySecondary,{children:[f,y?e.jsx("span",{children:"*"}):""]}),g>0&&e.jsxs(s.MaxCharStyle,{children:[null===(x=o.value)||void 0===x?void 0:x.length,"/",g]})]}))]}))}));o.displayName="Input",exports.Input=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './searchBar';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputVariant } from '../input/Input';
|
|
2
|
+
export interface SearchBarProps {
|
|
3
|
+
width: string;
|
|
4
|
+
isEnabled: boolean;
|
|
5
|
+
onChange: (searchText: string) => void;
|
|
6
|
+
onEnter: (searchText: string) => void;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
variant: InputVariant;
|
|
9
|
+
validate?: (input?: string | number) => [boolean, string];
|
|
10
|
+
}
|
|
11
|
+
export declare const SearchBar: (props: SearchBarProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{QueryBuilderType as l}from"../types/QueryBuilder.type.js";import r from"./DropdownWrapper.js";const t={[l.EVENT_FILTER]:{label:"Performed event",value:l.EVENT_FILTER},[l.NO_EVENT_FILTER]:{label:"Didn’t perform event",value:l.NO_EVENT_FILTER},[l.USER_PROPERTY_FILTER]:{label:"
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{QueryBuilderType as l}from"../types/QueryBuilder.type.js";import r from"./DropdownWrapper.js";const t={[l.EVENT_FILTER]:{label:"Performed event",value:l.EVENT_FILTER},[l.NO_EVENT_FILTER]:{label:"Didn’t perform event",value:l.NO_EVENT_FILTER},[l.USER_PROPERTY_FILTER]:{label:"Have user property",value:l.USER_PROPERTY_FILTER},[l.SEGMENT_FILTER]:{label:"Part of segment",value:l.SEGMENT_FILTER}},a=l=>{let{allowedList:a,onSelect:o,selectedType:E,loading:n,disabled:i}=l;const s=a.map((e=>{var l;return null!==(l=t[e])&&void 0!==l?l:null})).filter((e=>e)).map((e=>{var l;if(E)return(null==e?void 0:e.value)===(null===(l=t[E])||void 0===l?void 0:l.value)?Object.assign(Object.assign({},e),{selected:!0}):e}));return e(r,{disabled:i,width:"200px",isLoading:null!=n&&n,options:s,onSelect:o})};export{t as QUERY_TYPE_TO_OPTION_MAP,a as default};
|
package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as e,Fragment as o}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{isNewLineConnectorPosition as t}from"../../../constants/connectorPosition.js";import{ApiResponseHelper as i}from"../../../helpers/ApiResponse.helper.js";import l from"../../Connectors/Connector.js";import d from"../../DropdownWrapper.js";import{Container as s}from"./PropertyNode.styled.js";import p from"./PropertyNodeUIWrapper.js";const c=new i,u=e=>r(p,Object.assign({isLast:e.isLast,mode:e.mode},{children:r("div",Object.assign({style:{padding:12}},{children:r(v,Object.assign({},e))}))})),v=i=>{let{propertySelectorText:p,fetchPropertyData:u,onPropertyNameSelect:v,onPropertyOperatorChange:m,onPropertyValueChange:y,property:f,mode:g}=i;var h,j,b,A,O,C,T;const[w,P]=n([]),[x,L]=n({}),[S,V]=n(!0),[N,D]=n("create"===g),W=Array.isArray(w)?w.map((r=>Object.assign(Object.assign({},r),{label:r.name,value:r.id,description:r.description,selected:(null==f?void 0:f.name)===r.id}))):c.convertToGroupOptions(w,(null==f?void 0:f.name)?[f.name.toString()]:void 0);function k(r){if(!Array.isArray(r)){D(!0);let e=null;Array.isArray(w)?e=w.find((e=>{let{id:o}=e;return o===r.value})):Object.keys(w).forEach((o=>{const n=w[o].find((e=>{let{id:o}=e;return o===r.value}));n&&(e=n)})),L({}),e?null==v||v(e,f).then((r=>{L({options:Array.isArray(r)?[...r]:Object.assign({},r)}),D(!1)})):D(!1)}}return a((()=>{u?u().then((r=>{r&&(Array.isArray(r)?P([...r]):P(Object.assign({},r))),V(!1)})):V(!1)}),[]),a((()=>{if("create"!==g&&Array.isArray(w)){const r=w.find((r=>r.id===(null==f?void 0:f.name))),e=f;r&&k({value:r.id,label:r.name}),null==y||y(null==e?void 0:e.value,f)}}),[w]),e(o,{children:[e(s,{children:[r(d,{disabled:"view"===g,width:"200px",isLoading:S,dropdownLabel:null!=p?p:"Select property",options:W,onSelect:k,error:null===(h=null==f?void 0:f.error)||void 0===h?void 0:h.name}),(null==f?void 0:f.name)&&!(null===(j=t[f.dataType])||void 0===j?void 0:j[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(b=f.error)||void 0===b?void 0:b.value,operator:null===(A=f.error)||void 0===A?void 0:A.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>{null==m||m(r,f)},onValueChange:r=>null==y?void 0:y(r,f)})]}),(null==f?void 0:f.name)&&(null===(O=t[f.dataType])||void 0===O?void 0:O[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(C=f.error)||void 0===C?void 0:C.value,operator:null===(T=f.error)||void 0===T?void 0:T.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>null==m?void 0:m(r,f),onValueChange:r=>null==y?void 0:y(r,f)})]})};export{u as PropertyNode,v as PropertyNodeHeadless};
|
|
1
|
+
import{jsx as r,jsxs as e,Fragment as o}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{isNewLineConnectorPosition as t}from"../../../constants/connectorPosition.js";import{ApiResponseHelper as i}from"../../../helpers/ApiResponse.helper.js";import l from"../../Connectors/Connector.js";import d from"../../DropdownWrapper.js";import{Container as s}from"./PropertyNode.styled.js";import p from"./PropertyNodeUIWrapper.js";const c=new i,u=e=>r(p,Object.assign({isLast:e.isLast,mode:e.mode},{children:r("div",Object.assign({style:{padding:12}},{children:r(v,Object.assign({},e))}))})),v=i=>{let{propertySelectorText:p,fetchPropertyData:u,onPropertyNameSelect:v,onPropertyOperatorChange:m,onPropertyValueChange:y,property:f,mode:g}=i;var h,j,b,A,O,C,T;const[w,P]=n([]),[x,L]=n({}),[S,V]=n(!0),[N,D]=n("create"===g),W=Array.isArray(w)?w.map((r=>Object.assign(Object.assign({},r),{label:r.name,value:r.id,description:r.description,selected:(null==f?void 0:f.name)===r.id}))):c.convertToGroupOptions(w,(null==f?void 0:f.name)?[f.name.toString()]:void 0);function k(r){if(!Array.isArray(r)){D(!0);let e=null;Array.isArray(w)?e=w.find((e=>{let{id:o}=e;return o===r.value})):Object.keys(w).forEach((o=>{const n=w[o].find((e=>{let{id:o}=e;return o===r.value}));n&&(e=n)})),L({}),e?null==v||v(e,f).then((r=>{L({options:Array.isArray(r)?[...r]:Object.assign({},r)}),D(!1)})):D(!1)}}return a((()=>{u?u().then((r=>{r&&(Array.isArray(r)?P([...r]):P(Object.assign({},r))),V(!1),D(!1)})):(V(!1),D(!1))}),[]),a((()=>{if("create"!==g&&Array.isArray(w)){const r=w.find((r=>r.id===(null==f?void 0:f.name))),e=f;r&&k({value:r.id,label:r.name}),null==y||y(null==e?void 0:e.value,f)}}),[w]),e(o,{children:[e(s,{children:[r(d,{disabled:"view"===g,width:"200px",isLoading:S,dropdownLabel:null!=p?p:"Select property",options:W,onSelect:k,error:null===(h=null==f?void 0:f.error)||void 0===h?void 0:h.name}),(null==f?void 0:f.name)&&!(null===(j=t[f.dataType])||void 0===j?void 0:j[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(b=f.error)||void 0===b?void 0:b.value,operator:null===(A=f.error)||void 0===A?void 0:A.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>{null==m||m(r,f)},onValueChange:r=>null==y?void 0:y(r,f)})]}),(null==f?void 0:f.name)&&(null===(O=t[f.dataType])||void 0===O?void 0:O[f.operator])&&r(l,{isLoading:N,disabled:"view"===g,extra:x,errors:{val:null===(C=f.error)||void 0===C?void 0:C.value,operator:null===(T=f.error)||void 0===T?void 0:T.operator},connectorVal:f.value,connectorType:f.dataType,defaultConnector:f.operator,onOperatorChange:r=>null==m?void 0:m(r,f),onValueChange:r=>null==y?void 0:y(r,f)})]})};export{u as PropertyNode,v as PropertyNodeHeadless};
|
package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../../../_virtual/_tslib.js";import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{Dropdown as i}from"../../../../dropdown/Dropdown.js";import{JOIN_OPERATOR_OPTIONS as p}from"../../../constants/operators.js";import{QueryBuilderJoinOperators as
|
|
1
|
+
import{__rest as e}from"../../../../../_virtual/_tslib.js";import{jsxs as r,Fragment as t,jsx as o}from"react/jsx-runtime";import{Dropdown as i}from"../../../../dropdown/Dropdown.js";import{JOIN_OPERATOR_OPTIONS as p}from"../../../constants/operators.js";import{QueryBuilderJoinOperators as d}from"../../../types/QueryBuilder.type.js";import s from"../../DeleteButton.js";import l from"./AddPropertyButton.js";import{PropertyNode as n}from"./PropertyNode.js";import{Line as a}from"./PropertyNodeUIWrapper.styled.js";const c=c=>{var m,y,{node:u,addPropertyBtnText:v,deleteProperty:j,createProperty:f,selectPropertyJoinOperator:P,mode:h}=c,b=e(c,["node","addPropertyBtnText","deleteProperty","createProperty","selectPropertyJoinOperator","mode"]);const O=p.map((e=>{if(u.PropertyOperator){if(e.value===u.PropertyOperator)return Object.assign(Object.assign({},e),{selected:!0})}else if(e.value===d.AND)return Object.assign(Object.assign({},e),{selected:!0});return e}));return r(t,{children:[null===(m=null==u?void 0:u.properties)||void 0===m?void 0:m.map(((e,p)=>r(t,{children:[0!==p&&o("div",Object.assign({style:{width:80,position:"relative"}},{children:o(i,{disabled:"view"===h,onSelect:e=>{null==P||P(e.value,u._id)},options:O,width:"80px",height:96,size:"small"},`${p}-operator-selector`)}),`${p}-operator`),r("div",Object.assign({style:{display:"flex",flexDirection:"row"}},{children:[o(n,Object.assign({isLast:!!u.properties&&p===u.properties.length-1,property:e},b,{mode:h}),`${e._id}-property-node`),"view"!==h&&o(s,{onClick:()=>j(e,u._id)},`${e._id}-${p}-delete-btn`)]}),e._id)]}))),"view"!==h&&r("div",{children:[0===(null===(y=null==u?void 0:u.properties)||void 0===y?void 0:y.length)&&o("div",{children:o(a,{})}),o(l,{buttonText:null!=v?v:"Add Property",onClick:()=>f({},u._id)})]})]})};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{forwardRef as n,useState as l,useContext as r,useEffect as o}from"react";import{Button as a}from"../button/Button.js";import{BodySecondary as s}from"../TypographyStyle.js";import c from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as d}from"./context/InputStyleProvider.js";import{RootContainer as u,InputFooter as v,InputWrapper as h,IconHolder as p,PrefixHolder as f,InputContainer as g,InputContainerSmall as m,SuffixHolder as x,InputHeader as y,MaxCharStyle as b}from"./Input.styled.js";const j=e=>e&&"function"==typeof e,C=n(((n,C)=>{var w,I,O,T;const{placeholder:k,leftIcon:A,rightIcon:B,labelText:L,maxCharLimit:S,isRequired:D,hintText:E,type:F,state:z,validate:H,variant:K,button:M,suffixText:R,prefixText:q,onChangeText:N,value:P,noErrorHint:W}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},n),G=null==A?void 0:A.icon,J=null==B?void 0:B.icon,[Q,U]=l(!1),[V,X]=l(!1),[Y,Z]=l(),$="small"===K?"18px":"22px",_=r(d);o((()=>{X(!!n.isActive)}),[n.isActive]),o((()=>{Z(n.errorMessage)}),[n.errorMessage]),o((()=>{U(!1),("invalid"===n.state||Y)&&U(!0)}),[n.state,Y]),o((()=>{U(!!Y)}),[Y]);const ee=function(e){if(j(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)}},te=e=>{
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import{forwardRef as n,useState as l,useContext as r,useEffect as o}from"react";import{Button as a}from"../button/Button.js";import{BodySecondary as s}from"../TypographyStyle.js";import c from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as d}from"./context/InputStyleProvider.js";import{RootContainer as u,InputFooter as v,InputWrapper as h,IconHolder as p,PrefixHolder as f,InputContainer as g,InputContainerSmall as m,SuffixHolder as x,InputHeader as y,MaxCharStyle as b}from"./Input.styled.js";const j=e=>e&&"function"==typeof e,C=n(((n,C)=>{var w,I,O,T;const{placeholder:k,leftIcon:A,rightIcon:B,labelText:L,maxCharLimit:S,isRequired:D,hintText:E,type:F,state:z,validate:H,variant:K,button:M,suffixText:R,prefixText:q,onChangeText:N,value:P,noErrorHint:W}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},n),G=null==A?void 0:A.icon,J=null==B?void 0:B.icon,[Q,U]=l(!1),[V,X]=l(!1),[Y,Z]=l(),$="small"===K?"18px":"22px",_=r(d);o((()=>{X(!!n.isActive)}),[n.isActive]),o((()=>{Z(n.errorMessage)}),[n.errorMessage]),o((()=>{U(!1),("invalid"===n.state||Y)&&U(!0)}),[n.state,Y]),o((()=>{U(!!Y)}),[Y]);const ee=function(e){if(j(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)}},te=e=>{N(P||"",e),![8].includes(e.which)&&S>0&&e.target.value.length===S&&e.preventDefault()},ie=e=>{const t=e.target.value;if(N(t,e),!H||!j(H))return;const[i,n]=H(t);U(!i),Z(n)},ne=()=>{var l;return e(i,{children:["multiline"!==F&&t("input",{id:n.id,style:null!==(l=null==_?void 0:_.input)&&void 0!==l?l:{},ref:C,type:F,value:P,onFocus:()=>(X(!0),void ee(n.onFocus)),onBlur:e=>(e=>{var t;X(!1),ee(null===(t=n.onBlur)||void 0===t?void 0:t.call(n,e))})(e),placeholder:k||"Enter here",onChange:ie,onKeyDown:e=>te(e)}),"multiline"===F&&t("textarea",{value:P,ref:C,onFocus:()=>X(!0),onBlur:()=>X(!1),placeholder:k||"Enter here",onChange:ie,onKeyDown:e=>te(e)})]})};return e(u,Object.assign({width:n.width,height:n.height,state:z,type:F,style:null!==(w=null==_?void 0:_.RootContainer)&&void 0!==w?w:{}},{children:[!W&&(!!E||!!Y)&&e(v,Object.assign({invalid:!!Y},{children:[!!Y&&t(c,{width:16,height:16}),Y||E]})),e(h,Object.assign({variant:K,state:z,width:n.width,isActive:"active"===z||V,isInvalid:Q,style:null!==(I=null==_?void 0:_.InputWrapper)&&void 0!==I?I:{}},{children:[!!G&&t(p,Object.assign({variant:K,iconSize:$,onClick:()=>ee(null==A?void 0:A.callback),isLeft:!0,style:null!==(O=null==_?void 0:_.IconHolder)&&void 0!==O?O:{}},{children:t(G,{})})),!!q&&t(f,Object.assign({variant:K},{children:q})),"default"===K&&t(g,{children:ne()}),"small"===K&&t(m,{children:ne()}),!!J&&t(p,Object.assign({variant:K,iconSize:$,onClick:()=>ee(null==B?void 0:B.callback),isLeft:!1},{children:t(J,{})})),!!R&&t(x,Object.assign({variant:K},{children:R})),M&&M.text&&t(a,{buttonText:M.text,onClick:()=>ee(null==M?void 0:M.onClick)})]})),(!!L||!!S)&&"default"===K&&e(y,Object.assign({invalid:Q},{children:[e(s,{children:[L,D?t("span",{children:"*"}):""]}),S>0&&e(b,{children:[null===(T=n.value)||void 0===T?void 0:T.length,"/",S]})]}))]}))}));C.displayName="Input";export{C as Input};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './searchBar';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputVariant } from '../input/Input';
|
|
2
|
+
export interface SearchBarProps {
|
|
3
|
+
width: string;
|
|
4
|
+
isEnabled: boolean;
|
|
5
|
+
onChange: (searchText: string) => void;
|
|
6
|
+
onEnter: (searchText: string) => void;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
variant: InputVariant;
|
|
9
|
+
validate?: (input?: string | number) => [boolean, string];
|
|
10
|
+
}
|
|
11
|
+
export declare const SearchBar: (props: SearchBarProps) => JSX.Element;
|