@bikdotai/bik-component-library 0.0.505-beta.3 → 0.0.505-beta.4
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("react"),n=require("../../constants/Theme.js"),r=require("../accordion/Accordion.js"),l=require("../icon-button/IconButton.js"),o=require("../input/Input.js"),c=require("../list-item/ListItem.js"),d=require("../switch/Switch.js"),h=require("../TypographyStyle.js"),u=require("./context.js"),j=require("./recommendVaribles.js"),b=require("./searchVariables.js"),g=require("./styles.js"),m=require("./SubHeaderItems.js");exports.VariablePickerContent=
|
|
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("react"),n=require("../../constants/Theme.js"),r=require("../accordion/Accordion.js"),l=require("../icon-button/IconButton.js"),o=require("../input/Input.js"),c=require("../list-item/ListItem.js"),d=require("../switch/Switch.js"),h=require("../TypographyStyle.js"),u=require("./context.js"),j=require("./recommendVaribles.js"),b=require("./searchVariables.js"),g=require("./styles.js"),m=require("./SubHeaderItems.js");exports.VariablePickerContent=y=>{const{data:p,onSelect:x}=y,[v,O]=i.useState(p),[S,f]=i.useState(""),[q,w]=i.useState([]),[C,R]=i.useState(""),[V,k]=i.useState(!1),[I,N]=i.useState([]);i.useEffect((()=>{q.length>0?N([q[q.length-1]]):N(p)}),[q]);return s.jsx(u.VariablePickerContext.Provider,Object.assign({value:{variables:v,searchText:S,subHeaderStack:q,showRecommended:V,setSubHeaderStack:w,setSearchText:f,setVariables:O,setShowRecommended:k}},{children:s.jsxs("div",Object.assign({style:{backgroundColor:"white"}},{children:[s.jsx("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:n.COLORS.surface.subdued}},{children:s.jsx(o.Input,{value:S,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||R("");const s=b.searchVariables(e,I,q);if(V){const e=j.showOnlyRecommendedVariables(s,q);O(e)}else O(s);f(e);const t=q.length>0?q[q.length-1].displayName:"home";R(t)}})})),s.jsxs(g.RecommendWrapper,{children:[s.jsx(h.BodySecondary,Object.assign({style:{color:n.COLORS.content.secondary}},{children:"Only Recommended"})),s.jsx(d.Switch,{value:V,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield(s=>e.__awaiter(void 0,void 0,void 0,(function*(){if(k(s),s){const e=j.showOnlyRecommendedVariables(v,q);O(e)}else if(q.length>0){const e=C==q[q.length-1].displayName;if(S.length>0&&e){const e=b.searchVariables(S,I,q);O(e)}else O([q[q.length-1].variables])}else if(S.length>0){const e=b.searchVariables(S,I,q);O(e)}else O(p)})))(s)}))})]}),q.length>0&&s.jsxs(g.BackHeader,{children:[s.jsx("div",Object.assign({style:{position:"absolute",left:16}},{children:s.jsx(l.IconButton,{style:{display:"flex"},Icon:()=>s.jsx(t.default,{width:12,height:12,style:{color:n.COLORS.content.secondary}}),onClick:()=>{let e=S;const s=[...q],t=s.pop();if(w(s),t.displayName===C&&(f(""),e=""),e.length>0){const t=s.length>0?[s[s.length-1]]:p,a=b.searchVariables(e,t,s);if(V){const e=j.showOnlyRecommendedVariables(a,s);O(e)}else O(a)}else if(s.length>0)if(V){const e=j.showOnlyRecommendedVariables([s[s.length-1].variables],s);O(e)}else O([s[s.length-1].variables]);else if(V){const e=j.showOnlyRecommendedVariables(p,q);O(e)}else O(p)}})})),s.jsx(h.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:q[q.length-1].displayName}))]}),s.jsx(s.Fragment,{children:v.length>0?s.jsx(g.Container,Object.assign({height:(e=>{let s=104;return q.length>0&&(s+=54),`calc(${e}px - ${s}px)`})(500)},{children:v.map(((e,t)=>e.displayName&&void 0!==e.variables?s.jsx("div",Object.assign({style:{borderBottom:`1px solid ${n.COLORS.stroke.primary}`}},{children:s.jsx(r.BikAccordion,Object.assign({headerPadding:"12px 16px",header:s.jsx(h.TitleSmall,Object.assign({style:{color:n.COLORS.content.secondary}},{children:e.displayName}))},{children:s.jsx(m.default,{variable:e.variables,onSelect:x})}))}),t):e.displayName?s.jsx(c.ListItem,{version:"2.0",leadingIcon:s.jsx(a.default,{width:14,height:14}),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{x(e)}},t):s.jsx(m.default,{variable:e,onSelect:x},t)))})):s.jsx("p",{children:"No Result found"})})]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/arrow_back.svg.js";import n from"../../assets/icons/plus.svg.js";import{useState as l,useEffect as r}from"react";import{COLORS as a}from"../../constants/Theme.js";import{BikAccordion as c}from"../accordion/Accordion.js";import{IconButton as d}from"../icon-button/IconButton.js";import{Input as m}from"../input/Input.js";import{ListItem as h}from"../list-item/ListItem.js";import{Switch as p}from"../switch/Switch.js";import{BodySecondary as g,BodyCaption as
|
|
1
|
+
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/arrow_back.svg.js";import n from"../../assets/icons/plus.svg.js";import{useState as l,useEffect as r}from"react";import{COLORS as a}from"../../constants/Theme.js";import{BikAccordion as c}from"../accordion/Accordion.js";import{IconButton as d}from"../icon-button/IconButton.js";import{Input as m}from"../input/Input.js";import{ListItem as h}from"../list-item/ListItem.js";import{Switch as p}from"../switch/Switch.js";import{BodySecondary as g,BodyCaption as b,TitleSmall as f}from"../TypographyStyle.js";import{VariablePickerContext as y}from"./context.js";import{showOnlyRecommendedVariables as u}from"./recommendVaribles.js";import{searchVariables as v}from"./searchVariables.js";import{RecommendWrapper as j,BackHeader as x,Container as S}from"./styles.js";import O from"./SubHeaderItems.js";const N=N=>{const{data:w,onSelect:k}=N,[C,I]=l(w),[T,R]=l(""),[V,H]=l([]),[$,_]=l(""),[B,P]=l(!1),[A,D]=l([]);r((()=>{V.length>0?D([V[V.length-1]]):D(w)}),[V]);return t(y.Provider,Object.assign({value:{variables:C,searchText:T,subHeaderStack:V,showRecommended:B,setSubHeaderStack:H,setSearchText:R,setVariables:I,setShowRecommended:P}},{children:s("div",Object.assign({style:{backgroundColor:"white"}},{children:[t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:a.surface.subdued}},{children:t(m,{value:T,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||_("");const t=v(e,A,V);if(B){const e=u(t,V);I(e)}else I(t);R(e);const s=V.length>0?V[V.length-1].displayName:"home";_(s)}})})),s(j,{children:[t(g,Object.assign({style:{color:a.content.secondary}},{children:"Only Recommended"})),t(p,{value:B,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield(t=>e(void 0,void 0,void 0,(function*(){if(P(t),t){const e=u(C,V);I(e)}else if(V.length>0){const e=$==V[V.length-1].displayName;if(T.length>0&&e){const e=v(T,A,V);I(e)}else I([V[V.length-1].variables])}else if(T.length>0){const e=v(T,A,V);I(e)}else I(w)})))(t)}))})]}),V.length>0&&s(x,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(d,{style:{display:"flex"},Icon:()=>t(i,{width:12,height:12,style:{color:a.content.secondary}}),onClick:()=>{let e=T;const t=[...V],s=t.pop();if(H(t),s.displayName===$&&(R(""),e=""),e.length>0){const s=t.length>0?[t[t.length-1]]:w,o=v(e,s,t);if(B){const e=u(o,t);I(e)}else I(o)}else if(t.length>0)if(B){const e=u([t[t.length-1].variables],t);I(e)}else I([t[t.length-1].variables]);else if(B){const e=u(w,V);I(e)}else I(w)}})})),t(b,Object.assign({style:{color:a.content.secondary}},{children:V[V.length-1].displayName}))]}),t(o,{children:C.length>0?t(S,Object.assign({height:(e=>{let t=104;return V.length>0&&(t+=54),`calc(${e}px - ${t}px)`})(500)},{children:C.map(((e,s)=>e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${a.stroke.primary}`}},{children:t(c,Object.assign({headerPadding:"12px 16px",header:t(f,Object.assign({style:{color:a.content.secondary}},{children:e.displayName}))},{children:t(O,{variable:e.variables,onSelect:k})}))}),s):e.displayName?t(h,{version:"2.0",leadingIcon:t(n,{width:14,height:14}),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{k(e)}},s):t(O,{variable:e,onSelect:k},s)))})):t("p",{children:"No Result found"})})]}))}))};export{N as VariablePickerContent};
|