@bikdotai/bik-component-library 0.0.515-beta.0 → 0.0.515-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_back.svg.js"),a=require("../../assets/icons/plus.svg.js"),i=require("../../assets/icons/triangle_error.svg.js"),l=require("react"),r=require("../../constants/Theme.js"),n=require("../accordion/Accordion.js"),c=require("../icon-button/IconButton.js"),o=require("../input/Input.js"),d=require("../list-item/ListItem.js"),h=require("../switch/Switch.js"),u=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),g=require("./context.js"),b=require("./NoResult.js"),p=require("./recommendVaribles.js"),x=require("./searchVariables.js"),y=require("./styles.js"),m=require("./SubHeaderItems.js");const O=(e,t)=>{if(0===t.length)return e;const a=e.toLowerCase().indexOf(t.toLowerCase());if(-1===a)return e;const i=e.slice(0,a),l=e.slice(a,a+t.length),n=e.slice(a+t.length);return s.jsxs("span",{children:[i,s.jsx("b",Object.assign({style:{color:r.COLORS.content.primary}},{children:l})),n]})},f=/.*\..*/,v=e=>{if(e.actualValue.match(f)){const s=e.actualValue.replace("{{","").replace("}}","").split(".");let t=s[0];return s.forEach(((e,s)=>{if(0===s)return;const a=(e=>/\w+\[\d+\]/g.test(e))(e);if(a){const s=e.match(/(\w+)\[(\d+)\]/);if(s){const e=s[1],a=s[2];t+=`['${e}'][${a}]`}}else t+=`['${e}']`})),t}return e.actualValueEval?e.actualValueEval:e.actualValue};exports.VariablePickerContent=f=>{const{data:S,onSelect:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_back.svg.js"),a=require("../../assets/icons/plus.svg.js"),i=require("../../assets/icons/triangle_error.svg.js"),l=require("react"),r=require("../../constants/Theme.js"),n=require("../accordion/Accordion.js"),c=require("../icon-button/IconButton.js"),o=require("../input/Input.js"),d=require("../list-item/ListItem.js"),h=require("../switch/Switch.js"),u=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),g=require("./context.js"),b=require("./NoResult.js"),p=require("./recommendVaribles.js"),x=require("./searchVariables.js"),y=require("./styles.js"),m=require("./SubHeaderItems.js");const O=(e,t)=>{if(0===t.length)return e;const a=e.toLowerCase().indexOf(t.toLowerCase());if(-1===a)return e;const i=e.slice(0,a),l=e.slice(a,a+t.length),n=e.slice(a+t.length);return s.jsxs("span",{children:[i,s.jsx("b",Object.assign({style:{color:r.COLORS.content.primary}},{children:l})),n]})},f=/.*\..*/,v=e=>{if(e.actualValue.match(f)){const s=e.actualValue.replace("{{","").replace("}}","").split(".");let t=s[0];return s.forEach(((e,s)=>{if(0===s)return;const a=(e=>/\w+\[\d+\]/g.test(e))(e);if(a){const s=e.match(/(\w+)\[(\d+)\]/);if(s){const e=s[1],a=s[2];t+=`['${e}'][${a}]`}}else t+=`['${e}']`})),t}return e.actualValueEval?e.actualValueEval:e.actualValue};exports.VariablePickerContent=f=>{const{data:S,onSelect:w,showHeader:C,showBackButton:R,onBackButtonClick:V,isEvaluationList:k}=f,[q,B]=l.useState(S),[L,I]=l.useState(""),[T,N]=l.useState([]),[_,H]=l.useState(""),[P,E]=l.useState(!1),[$,A]=l.useState([]);l.useEffect((()=>{W(!0)}),[]),l.useEffect((()=>{T.length>0?A([T[T.length-1]]):A(S)}),[T]);const W=s=>e.__awaiter(void 0,void 0,void 0,(function*(){if(E(s),s){const e=p.showOnlyRecommendedVariables(q,T);B(e)}else if(T.length>0){const e=_==T[T.length-1].displayName;if(L.length>0&&e){const e=x.searchVariables(L,$,T);B(e)}else B([T[T.length-1].variables])}else if(L.length>0){const e=x.searchVariables(L,$,T);B(e)}else B(S)})),z=()=>{let e=123;return T.length>0&&(e+=32),(f.showHeader||f.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return s.jsx(g.VariablePickerContext.Provider,Object.assign({value:{variables:q,searchText:L,subHeaderStack:T,showRecommended:P,setSubHeaderStack:N,setSearchText:I,setVariables:B,setShowRecommended:E}},{children:s.jsxs("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(C||R)&&s.jsxs(y.HeaderWrapper,{children:[R&&s.jsx(c.IconButton,{Icon:()=>s.jsx(t.default,{width:16,height:16,style:{display:"flex",color:r.COLORS.content.primary}}),onClick:V}),C&&s.jsx(j.TitleRegular,{children:"Select Variable"})]}),s.jsx("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:r.COLORS.surface.subdued}},{children:s.jsx(o.Input,{id:"search-bar-v3-picker",onBlur:e=>{f.onSearchBlur&&f.onSearchBlur(e)},value:L,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||H("");const s=x.searchVariables(e,$,T);if(P){const e=p.showOnlyRecommendedVariables(s,T);B(e)}else B(s);I(e);const t=T.length>0?T[T.length-1].displayName:"home";H(t)}})})),s.jsxs(y.RecommendWrapper,{children:[s.jsx(j.BodySecondary,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Only Recommended"})),s.jsx(h.Switch,{value:P,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield W(s)}))})]}),T.length>0&&s.jsxs(y.BackHeader,{children:[s.jsx("div",Object.assign({style:{position:"absolute",left:16}},{children:s.jsx(c.IconButton,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>s.jsx(t.default,{width:12,height:12,style:{color:r.COLORS.content.secondary}}),onClick:e=>{e.stopPropagation();let s=L;const t=[...T],a=t.pop();if(N(t),a.displayName===_&&(I(""),s=""),s.length>0){const e=t.length>0?[t[t.length-1]]:S,a=x.searchVariables(s,e,t);if(P){const e=p.showOnlyRecommendedVariables(a,t);B(e)}else B(a)}else if(t.length>0)if(P){const e=p.showOnlyRecommendedVariables([t[t.length-1].variables],t);B(e)}else B([t[t.length-1].variables]);else if(P){const e=p.showOnlyRecommendedVariables(S,T);B(e)}else B(S)}})})),s.jsx(j.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:T[T.length-1].displayName}))]}),s.jsx(s.Fragment,{children:q.length>0?s.jsx(y.Container,Object.assign({height:z()},{children:q.map(((e,t)=>e.displayName&&void 0!==e.variables?s.jsx("div",Object.assign({style:{borderBottom:`1px solid ${r.COLORS.stroke.primary}`}},{children:s.jsx(n.BikAccordion,Object.assign({headerPadding:"12px 16px",header:s.jsx(j.TitleSmall,Object.assign({style:{color:r.COLORS.content.secondary}},{children:O(e.displayName,L)}))},{children:s.jsx(m.default,{searchText:L,variable:e.variables,onSelect:w})}))}),t):e.displayName?s.jsx(d.ListItem,{version:"2.0",leadingIcon:s.jsx(a.default,{width:14,height:14}),customListItemLabel:s.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:4}},{children:[s.jsx(j.BodySecondary,Object.assign({style:{fontSize:"14px",color:r.COLORS.text.primary}},{children:O(e.displayName,L)})),!e.isAvailable&&s.jsx(u.Tooltip,Object.assign({body:"Not Recommended"},{children:s.jsx("div",Object.assign({style:{display:"flex"}},{children:s.jsx(i.default,{width:16,height:16,color:r.COLORS.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(k){const s=v(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t):s.jsx(m.default,{searchText:L,variable:e,onSelect:e=>{if(k){const s=v(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)))})):s.jsx(b.default,{height:z(),searchText:L})})]}))}))},exports.highlightSearchText=O;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/cross.svg.js"),t=require("../../constants/Theme.js"),r=require("../modals/modal.styled.js"),i=require("./Content.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/cross.svg.js"),t=require("../../constants/Theme.js"),r=require("../modals/modal.styled.js"),i=require("./Content.js"),n=require("./model.js");const o=o=>{var a;const{type:c}=o;return c==n.PickerType.FLOATER?e.jsxs("div",Object.assign({style:{boxShadow:"0px 2px 8px 0px #0000001F",width:o.width?o.width:344,borderRadius:4}},{children:[e.jsx(i.VariablePickerContent,Object.assign({},o)),e.jsx(r.CloseButtonContainer,Object.assign({onClick:()=>{o.onClose&&o.onClose()}},{children:e.jsx(s.default,{height:20,width:20,color:t.COLORS.content.secondary})}))]})):e.jsx("div",Object.assign({style:{width:null!==(a=o.width)&&void 0!==a?a:"100%",height:"100%"}},{children:e.jsx(i.VariablePickerContent,Object.assign({},o))}))};exports.VariablePicker=o,exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import
|
|
1
|
+
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import n from"../../assets/icons/plus.svg.js";import l from"../../assets/icons/triangle_error.svg.js";import{useState as a,useEffect as r}from"react";import{COLORS as c}from"../../constants/Theme.js";import{BikAccordion as d}from"../accordion/Accordion.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as m}from"../input/Input.js";import{ListItem as p}from"../list-item/ListItem.js";import{Switch as g}from"../switch/Switch.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleRegular as b,BodySecondary as f,BodyCaption as y,TitleSmall as v}from"../TypographyStyle.js";import{VariablePickerContext as j}from"./context.js";import x from"./NoResult.js";import{showOnlyRecommendedVariables as O}from"./recommendVaribles.js";import{searchVariables as w}from"./searchVariables.js";import{HeaderWrapper as k,RecommendWrapper as S,BackHeader as C,Container as N}from"./styles.js";import V from"./SubHeaderItems.js";const B=(e,i)=>{if(0===i.length)return e;const o=e.toLowerCase().indexOf(i.toLowerCase());if(-1===o)return e;const n=e.slice(0,o),l=e.slice(o,o+i.length),a=e.slice(o+i.length);return s("span",{children:[n,t("b",Object.assign({style:{color:c.content.primary}},{children:l})),a]})},I=/.*\..*/,T=e=>{if(e.actualValue.match(I)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let s=t[0];return t.forEach(((e,t)=>{if(0===t)return;const i=(e=>/\w+\[\d+\]/g.test(e))(e);if(i){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],i=t[2];s+=`['${e}'][${i}]`}}else s+=`['${e}']`})),s}return e.actualValueEval?e.actualValueEval:e.actualValue},L=I=>{const{data:L,onSelect:R,showHeader:H,showBackButton:$,onBackButtonClick:E,isEvaluationList:P}=I,[_,A]=a(L),[z,D]=a(""),[K,q]=a([]),[F,G]=a(""),[J,M]=a(!1),[Q,U]=a([]);r((()=>{W(!0)}),[]),r((()=>{K.length>0?U([K[K.length-1]]):U(L)}),[K]);const W=t=>e(void 0,void 0,void 0,(function*(){if(M(t),t){const e=O(_,K);A(e)}else if(K.length>0){const e=F==K[K.length-1].displayName;if(z.length>0&&e){const e=w(z,Q,K);A(e)}else A([K[K.length-1].variables])}else if(z.length>0){const e=w(z,Q,K);A(e)}else A(L)})),X=()=>{let e=123;return K.length>0&&(e+=32),(I.showHeader||I.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return t(j.Provider,Object.assign({value:{variables:_,searchText:z,subHeaderStack:K,showRecommended:J,setSubHeaderStack:q,setSearchText:D,setVariables:A,setShowRecommended:M}},{children:s("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(H||$)&&s(k,{children:[$&&t(h,{Icon:()=>t(o,{width:16,height:16,style:{display:"flex",color:c.content.primary}}),onClick:E}),H&&t(b,{children:"Select Variable"})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:c.surface.subdued}},{children:t(m,{id:"search-bar-v3-picker",onBlur:e=>{I.onSearchBlur&&I.onSearchBlur(e)},value:z,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||G("");const t=w(e,Q,K);if(J){const e=O(t,K);A(e)}else A(t);D(e);const s=K.length>0?K[K.length-1].displayName:"home";G(s)}})})),s(S,{children:[t(f,Object.assign({style:{color:c.content.secondary}},{children:"Only Recommended"})),t(g,{value:J,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield W(t)}))})]}),K.length>0&&s(C,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(h,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(o,{width:12,height:12,style:{color:c.content.secondary}}),onClick:e=>{e.stopPropagation();let t=z;const s=[...K],i=s.pop();if(q(s),i.displayName===F&&(D(""),t=""),t.length>0){const e=s.length>0?[s[s.length-1]]:L,i=w(t,e,s);if(J){const e=O(i,s);A(e)}else A(i)}else if(s.length>0)if(J){const e=O([s[s.length-1].variables],s);A(e)}else A([s[s.length-1].variables]);else if(J){const e=O(L,K);A(e)}else A(L)}})})),t(y,Object.assign({style:{color:c.content.secondary}},{children:K[K.length-1].displayName}))]}),t(i,{children:_.length>0?t(N,Object.assign({height:X()},{children:_.map(((e,i)=>e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${c.stroke.primary}`}},{children:t(d,Object.assign({headerPadding:"12px 16px",header:t(v,Object.assign({style:{color:c.content.secondary}},{children:B(e.displayName,z)}))},{children:t(V,{searchText:z,variable:e.variables,onSelect:R})}))}),i):e.displayName?t(p,{version:"2.0",leadingIcon:t(n,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:4}},{children:[t(f,Object.assign({style:{fontSize:"14px",color:c.text.primary}},{children:B(e.displayName,z)})),!e.isAvailable&&t(u,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex"}},{children:t(l,{width:16,height:16,color:c.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(P){const t=T(e);R(Object.assign(Object.assign({},e),{actualValue:t}))}else R(e)}},i):t(V,{searchText:z,variable:e,onSelect:e=>{if(P){const t=T(e);R(Object.assign(Object.assign({},e),{actualValue:t}))}else R(e)}},i)))})):t(x,{height:X(),searchText:z})})]}))}))};export{L as VariablePickerContent,B as highlightSearchText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as t,jsx as s}from"react/jsx-runtime";import o from"../../assets/icons/cross.svg.js";import{COLORS as e}from"../../constants/Theme.js";import{CloseButtonContainer as i}from"../modals/modal.styled.js";import{VariablePickerContent as r}from"./Content.js";import{PickerType as n}from"./model.js";const d=d=>{var c;const{type:m}=d;return m==n.FLOATER?t("div",Object.assign({style:{boxShadow:"0px 2px 8px 0px #0000001F",width:d.width?d.width:344,borderRadius:4}},{children:[s(r,Object.assign({},d)),s(i,Object.assign({onClick:()=>{d.onClose&&d.onClose()}},{children:s(o,{height:20,width:20,color:e.content.secondary})}))]})):s("div",Object.assign({style:{width:null!==(c=d.width)&&void 0!==c?c:"100%",height:"100%"}},{children:s(r,Object.assign({},d))}))};export{d as VariablePicker,d as default};
|