@bikdotai/bik-component-library 0.0.387-beta.102 → 0.0.387

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.
@@ -31,7 +31,6 @@ export interface AnalyticsDropdownInterface {
31
31
  };
32
32
  variant?: 'small' | 'default';
33
33
  datePickerPlacement?: DropDirection;
34
- allowReset?: boolean;
35
34
  }
36
35
  export declare const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface>;
37
36
  export declare const EachItem: React.FC<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(t),isSelected:t.isCustom?t.key==(null==s?void 0:s.key)&&!!a:t.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:t.key==(null==s?void 0:s.key)?n.BASE_COLORS.positive[900]:n.BASE_COLORS.grayscale[900]},{children:t.label})),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),t.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=c=>{let{options:r,placeholder:u="Select an option",selected:g,onOptionSelected:p,resetDropdown:v,maxHeight:m,backgroundColor:O,calendarPopperConfig:j,variant:D="default",datePickerPlacement:y,allowReset:S}=c;var b,h,x;const[f,k]=o.useState(!1),[w,R]=o.useState(g),[C,E]=o.useState(),[T,A]=o.useState(!1),M=()=>{!f&&A(!T)},[q,P]=o.useState(g),$="small"===D?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&R(void 0)}),[v]),o.useEffect((()=>{var e;(null==g?void 0:g.isCustom)&&(null===(e=g.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?E(g.dateRangeSelectionOptions.selectedDates):S?(R(g),E(void 0)):g&&R(g)}),[g]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:T,onToggle:M,backgroundColor:O},{children:[e.jsx(t.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${n.DEFAULT_THEME.colorsV2.stroke.primary}`}:void 0},{children:e.jsx($,Object.assign({style:"small"===D?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==w?void 0:w.isCustom)?C?d(C[0])===d(C[1])?`${d(C[0])}`:`${d(C[0])} to ${d(C[1])}`:null==q?void 0:q.label:w?null==w?void 0:w.label:u}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"main--dropdown"},{children:e.jsxs(l.MainDropdown,Object.assign({drop:null!=y?y:"end",id:"sub--dropdown",show:f,onToggle:e=>{!e&&A(!1),k(!f)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:m||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e.jsx("div",{children:(null==o?void 0:o.isCustom)?e.jsx(t.Dropdown.Toggle,Object.assign({className:"sub--dropdown"},{children:e.jsx(a,{eachOption:o,selectedOption:w,selectedDate:C,onClickingEachItem:e=>{R(e),k(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e.jsx(a,{eachOption:o,selectedOption:w,selectedDate:C,onClickingEachItem:e=>{if(E(void 0),R(e),P(e),M(),!e.noOfDays)return void p(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),p(Object.assign(Object.assign({},e),{selectedRange:[t,o]}))}})},null==o?void 0:o.key)}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==j?void 0:j.offsetSkid)||0,(null==j?void 0:j.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(b=null==w?void 0:w.dateRangeSelectionOptions)||void 0===b?void 0:b.selectRange)||!1,maxDate:null===(h=null==w?void 0:w.dateRangeSelectionOptions)||void 0===h?void 0:h.maxDate,minDate:null===(x=null==w?void 0:w.dateRangeSelectionOptions)||void 0===x?void 0:x.minDate,selectedDates:C,onSelectRange:(e,o)=>{const t=[e,o];(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=t,p(Object.assign(Object.assign({},w),{selectedRange:[e,o]}))),P(w),k(!1),E(t),A(!T)},onSelectDate:e=>{(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=[e,e],p(Object.assign(Object.assign({},w),{selectedRange:[e,e]}))),P(w),k(!1),E([e,e]),A(!T)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(t),isSelected:t.isCustom?t.key==(null==s?void 0:s.key)&&!!a:t.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:t.key==(null==s?void 0:s.key)?n.BASE_COLORS.positive[900]:n.BASE_COLORS.grayscale[900]},{children:t.label})),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),t.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=c=>{let{options:r,placeholder:u="Select an option",selected:g,onOptionSelected:p,resetDropdown:v,maxHeight:m,backgroundColor:O,calendarPopperConfig:j,variant:D="default",datePickerPlacement:y}=c;var S,b,h;const[x,f]=o.useState(!1),[k,w]=o.useState(g),[C,R]=o.useState(),[E,T]=o.useState(!1),A=()=>{!x&&T(!E)},[M,q]=o.useState(g),P="small"===D?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&w(void 0)}),[v]),o.useEffect((()=>{var e;(null==g?void 0:g.isCustom)&&(null===(e=g.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?R(g.dateRangeSelectionOptions.selectedDates):R(void 0),w(g)}),[g]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:E,onToggle:A,backgroundColor:O},{children:[e.jsx(t.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${n.DEFAULT_THEME.colorsV2.stroke.primary}`}:void 0},{children:e.jsx(P,Object.assign({style:"small"===D?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==k?void 0:k.isCustom)?C?d(C[0])===d(C[1])?`${d(C[0])}`:`${d(C[0])} to ${d(C[1])}`:null==M?void 0:M.label:k?null==k?void 0:k.label:u}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"main--dropdown"},{children:e.jsxs(l.MainDropdown,Object.assign({drop:null!=y?y:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&T(!1),f(!x)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:m||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e.jsx("div",{children:(null==o?void 0:o.isCustom)?e.jsx(t.Dropdown.Toggle,Object.assign({className:"sub--dropdown"},{children:e.jsx(a,{eachOption:o,selectedOption:k,selectedDate:C,onClickingEachItem:e=>{w(e),f(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e.jsx(a,{eachOption:o,selectedOption:k,selectedDate:C,onClickingEachItem:e=>{if(R(void 0),w(e),q(e),A(),!e.noOfDays)return void p(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),p(Object.assign(Object.assign({},e),{selectedRange:[t,o]}))}})},null==o?void 0:o.key)}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==j?void 0:j.offsetSkid)||0,(null==j?void 0:j.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(S=null==k?void 0:k.dateRangeSelectionOptions)||void 0===S?void 0:S.selectRange)||!1,maxDate:null===(b=null==k?void 0:k.dateRangeSelectionOptions)||void 0===b?void 0:b.maxDate,minDate:null===(h=null==k?void 0:k.dateRangeSelectionOptions)||void 0===h?void 0:h.minDate,selectedDates:C,onSelectRange:(e,o)=>{const t=[e,o];(null==k?void 0:k.dateRangeSelectionOptions)&&(k.dateRangeSelectionOptions.selectedDates=t,p(Object.assign(Object.assign({},k),{selectedRange:[e,o]}))),q(k),f(!1),R(t),T(!E)},onSelectDate:e=>{(null==k?void 0:k.dateRangeSelectionOptions)&&(k.dateRangeSelectionOptions.selectedDates=[e,e],p(Object.assign(Object.assign({},k),{selectedRange:[e,e]}))),q(k),f(!1),R([e,e]),T(!E)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
@@ -31,7 +31,6 @@ export interface AnalyticsDropdownInterface {
31
31
  };
32
32
  variant?: 'small' | 'default';
33
33
  datePickerPlacement?: DropDirection;
34
- allowReset?: boolean;
35
34
  }
36
35
  export declare const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface>;
37
36
  export declare const EachItem: React.FC<{
@@ -1 +1 @@
1
- import{jsx as e,Fragment as o,jsxs as t}from"react/jsx-runtime";import{useState as n,useEffect as l}from"react";import{Dropdown as i}from"react-bootstrap";import{DEFAULT_THEME as s,BASE_COLORS as a}from"../../constants/Theme.js";import{DatePicker as d}from"../datePicker/DatePicker.js";import{BodySecondary as c,BodyCaption as r,Caption as g}from"../TypographyStyle.js";import{MainDropdown as p,ItemMenuContainer as u}from"./CommonStyles.js";const m=a=>{let{options:r,placeholder:u="Select an option",selected:m,onOptionSelected:b,resetDropdown:h,maxHeight:f,backgroundColor:y,calendarPopperConfig:k,variant:D="default",datePickerPlacement:j,allowReset:S}=a;var R,C,w;const[x,$]=n(!1),[T,P]=n(m),[I,N]=n(),[A,E]=n(!1),F=()=>{!x&&E(!A)},[H,M]=n(m),V="small"===D?g:c;return l((()=>{h&&P(void 0)}),[h]),l((()=>{var e;(null==m?void 0:m.isCustom)&&(null===(e=m.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?N(m.dateRangeSelectionOptions.selectedDates):S?(P(m),N(void 0)):m&&P(m)}),[m]),e(o,{children:t(p,Object.assign({drop:"down",show:A,onToggle:F,backgroundColor:y},{children:[e(i.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${s.colorsV2.stroke.primary}`}:void 0},{children:e(V,Object.assign({style:"small"===D?{color:s.colorsV2.content.secondary}:void 0},{children:(null==T?void 0:T.isCustom)?I?O(I[0])===O(I[1])?`${O(I[0])}`:`${O(I[0])} to ${O(I[1])}`:null==H?void 0:H.label:T?null==T?void 0:T.label:u}))})),e(i.Menu,Object.assign({className:"main--dropdown"},{children:t(p,Object.assign({drop:null!=j?j:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&E(!1),$(!x)}},{children:[e("div",Object.assign({style:{maxHeight:f||"auto",overflowY:"scroll"}},{children:r.map((o=>{var t;return e("div",{children:(null==o?void 0:o.isCustom)?e(i.Toggle,Object.assign({className:"sub--dropdown"},{children:e(v,{eachOption:o,selectedOption:T,selectedDate:I,onClickingEachItem:e=>{P(e),$(!0)},rangeSelection:!!(null===(t=null==o?void 0:o.dateRangeSelectionOptions)||void 0===t?void 0:t.selectRange)})})):e(v,{eachOption:o,selectedOption:T,selectedDate:I,onClickingEachItem:e=>{if(N(void 0),P(e),M(e),F(),!e.noOfDays)return void b(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),b(Object.assign(Object.assign({},e),{selectedRange:[t,o]}))}})},null==o?void 0:o.key)}))})),e(i.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==k?void 0:k.offsetSkid)||0,(null==k?void 0:k.offsetDistance)||0]}}]}},{children:e(d,{selectRange:(null===(R=null==T?void 0:T.dateRangeSelectionOptions)||void 0===R?void 0:R.selectRange)||!1,maxDate:null===(C=null==T?void 0:T.dateRangeSelectionOptions)||void 0===C?void 0:C.maxDate,minDate:null===(w=null==T?void 0:T.dateRangeSelectionOptions)||void 0===w?void 0:w.minDate,selectedDates:I,onSelectRange:(e,o)=>{const t=[e,o];(null==T?void 0:T.dateRangeSelectionOptions)&&(T.dateRangeSelectionOptions.selectedDates=t,b(Object.assign(Object.assign({},T),{selectedRange:[e,o]}))),M(T),$(!1),N(t),E(!A)},onSelectDate:e=>{(null==T?void 0:T.dateRangeSelectionOptions)&&(T.dateRangeSelectionOptions.selectedDates=[e,e],b(Object.assign(Object.assign({},T),{selectedRange:[e,e]}))),M(T),$(!1),N([e,e]),E(!A)}})}))]}))}))]}))})},v=o=>{let{eachOption:n,selectedOption:l,selectedDate:i,onClickingEachItem:s,rangeSelection:d}=o;return t(u,Object.assign({onClick:()=>s(n),isSelected:n.isCustom?n.key==(null==l?void 0:l.key)&&!!i:n.key==(null==l?void 0:l.key)},{children:[e(c,Object.assign({color:n.key==(null==l?void 0:l.key)?a.positive[900]:a.grayscale[900]},{children:n.label})),i&&(null==l?void 0:l.isCustom)&&n.key==(null==l?void 0:l.key)&&e(r,{children:d?`${O(i[0])} to ${O(i[1])}`:`${O(i[0])}`})]}),n.key)},O=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});export{m as AnalyticsDropdown,v as EachItem,O as formatDate};
1
+ import{jsx as e,Fragment as o,jsxs as n}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import{Dropdown as i}from"react-bootstrap";import{DEFAULT_THEME as s,BASE_COLORS as a}from"../../constants/Theme.js";import{DatePicker as d}from"../datePicker/DatePicker.js";import{BodySecondary as c,BodyCaption as r,Caption as g}from"../TypographyStyle.js";import{MainDropdown as p,ItemMenuContainer as u}from"./CommonStyles.js";const m=a=>{let{options:r,placeholder:u="Select an option",selected:m,onOptionSelected:b,resetDropdown:h,maxHeight:f,backgroundColor:y,calendarPopperConfig:k,variant:D="default",datePickerPlacement:j}=a;var S,R,C;const[w,x]=t(!1),[$,T]=t(m),[P,I]=t(),[N,A]=t(!1),E=()=>{!w&&A(!N)},[F,H]=t(m),M="small"===D?g:c;return l((()=>{h&&T(void 0)}),[h]),l((()=>{var e;(null==m?void 0:m.isCustom)&&(null===(e=m.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?I(m.dateRangeSelectionOptions.selectedDates):I(void 0),T(m)}),[m]),e(o,{children:n(p,Object.assign({drop:"down",show:N,onToggle:E,backgroundColor:y},{children:[e(i.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${s.colorsV2.stroke.primary}`}:void 0},{children:e(M,Object.assign({style:"small"===D?{color:s.colorsV2.content.secondary}:void 0},{children:(null==$?void 0:$.isCustom)?P?O(P[0])===O(P[1])?`${O(P[0])}`:`${O(P[0])} to ${O(P[1])}`:null==F?void 0:F.label:$?null==$?void 0:$.label:u}))})),e(i.Menu,Object.assign({className:"main--dropdown"},{children:n(p,Object.assign({drop:null!=j?j:"end",id:"sub--dropdown",show:w,onToggle:e=>{!e&&A(!1),x(!w)}},{children:[e("div",Object.assign({style:{maxHeight:f||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e("div",{children:(null==o?void 0:o.isCustom)?e(i.Toggle,Object.assign({className:"sub--dropdown"},{children:e(v,{eachOption:o,selectedOption:$,selectedDate:P,onClickingEachItem:e=>{T(e),x(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e(v,{eachOption:o,selectedOption:$,selectedDate:P,onClickingEachItem:e=>{if(I(void 0),T(e),H(e),E(),!e.noOfDays)return void b(e);const o=new Date,n=new Date;n.setDate(o.getDate()-e.noOfDays),b(Object.assign(Object.assign({},e),{selectedRange:[n,o]}))}})},null==o?void 0:o.key)}))})),e(i.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==k?void 0:k.offsetSkid)||0,(null==k?void 0:k.offsetDistance)||0]}}]}},{children:e(d,{selectRange:(null===(S=null==$?void 0:$.dateRangeSelectionOptions)||void 0===S?void 0:S.selectRange)||!1,maxDate:null===(R=null==$?void 0:$.dateRangeSelectionOptions)||void 0===R?void 0:R.maxDate,minDate:null===(C=null==$?void 0:$.dateRangeSelectionOptions)||void 0===C?void 0:C.minDate,selectedDates:P,onSelectRange:(e,o)=>{const n=[e,o];(null==$?void 0:$.dateRangeSelectionOptions)&&($.dateRangeSelectionOptions.selectedDates=n,b(Object.assign(Object.assign({},$),{selectedRange:[e,o]}))),H($),x(!1),I(n),A(!N)},onSelectDate:e=>{(null==$?void 0:$.dateRangeSelectionOptions)&&($.dateRangeSelectionOptions.selectedDates=[e,e],b(Object.assign(Object.assign({},$),{selectedRange:[e,e]}))),H($),x(!1),I([e,e]),A(!N)}})}))]}))}))]}))})},v=o=>{let{eachOption:t,selectedOption:l,selectedDate:i,onClickingEachItem:s,rangeSelection:d}=o;return n(u,Object.assign({onClick:()=>s(t),isSelected:t.isCustom?t.key==(null==l?void 0:l.key)&&!!i:t.key==(null==l?void 0:l.key)},{children:[e(c,Object.assign({color:t.key==(null==l?void 0:l.key)?a.positive[900]:a.grayscale[900]},{children:t.label})),i&&(null==l?void 0:l.isCustom)&&t.key==(null==l?void 0:l.key)&&e(r,{children:d?`${O(i[0])} to ${O(i[1])}`:`${O(i[0])}`})]}),t.key)},O=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});export{m as AnalyticsDropdown,v as EachItem,O as formatDate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.387-beta.102",
3
+ "version": "0.0.387",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",