@bikdotai/bik-component-library 0.0.518-subtext-beta.0 → 0.0.518-subtext-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("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js");require("react-calendar"),require("../../utils/DateUtils.js");var i=require("../TypographyStyle.js");require("../datePicker/DatePickerWrapper.styled.js");var l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:r,rangeSelection:c}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>r(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})),t.subLabel?e.jsx(i.Caption,Object.assign({style:{color:"#616161"}},{children:t.subLabel})):e.jsx(e.Fragment,{}),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:c?`${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=r=>{let{options:c,placeholder:u="Select an option",selected:p,onOptionSelected:g,resetDropdown:v,maxHeight:j,backgroundColor:m,calendarPopperConfig:O,variant:D="default",datePickerPlacement:b,closeDropdown:y}=r;var S,x,h;const[f,k]=o.useState(!1),[w,C]=o.useState(p),[R,E]=o.useState(),[q,T]=o.useState(!1),P=()=>{!f&&T(!q)},[A,M]=o.useState(p),F="small"===D?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&C(void 0)}),[v]),o.useEffect((()=>{var e;(null==p?void 0:p.isCustom)&&(null===(e=p.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?E(p.dateRangeSelectionOptions.selectedDates):E(void 0),C(p)}),[p]),o.useEffect((()=>{T(!1),k(!1)}),[y]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:q,onToggle:P,backgroundColor:m,id:"analytic-dropdown"},{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(F,Object.assign({style:"small"===D?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==w?void 0:w.isCustom)?R?d(R[0])===d(R[1])?`${d(R[0])}`:`${d(R[0])} to ${d(R[1])}`:(null==A?void 0:A.label)?null==A?void 0:A.label:u: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!=b?b:"end",id:"sub--dropdown",show:f,onToggle:e=>{!e&&T(!1),k(!f)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:j||"auto",overflowY:"scroll"}},{children:c.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:R,onClickingEachItem:e=>{C(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:R,onClickingEachItem:e=>{if(E(void 0),C(e),M(e),P(),!e.noOfDays)return void g(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),g(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==O?void 0:O.offsetSkid)||0,(null==O?void 0:O.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(S=null==w?void 0:w.dateRangeSelectionOptions)||void 0===S?void 0:S.selectRange)||!1,maxDate:null===(x=null==w?void 0:w.dateRangeSelectionOptions)||void 0===x?void 0:x.maxDate,minDate:null===(h=null==w?void 0:w.dateRangeSelectionOptions)||void 0===h?void 0:h.minDate,selectedDates:R,onSelectRange:(e,o)=>{const t=[e,o];(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=t,g(Object.assign(Object.assign({},w),{selectedRange:[e,o]}))),M(w),k(!1),E(t),T(!q)},onSelectDate:e=>{(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=[e,e],g(Object.assign(Object.assign({},w),{selectedRange:[e,e]}))),M(w),k(!1),E([e,e]),T(!q)}})}))]}))}))]}))})},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");require("react-calendar"),require("../../utils/DateUtils.js");var i=require("../TypographyStyle.js");require("../datePicker/DatePickerWrapper.styled.js");var l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:r,rangeSelection:c}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>r(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})),t.subLabel?e.jsx(i.BodyCaption,Object.assign({style:{color:n.BASE_COLORS.grayscale[700]}},{children:t.subLabel})):e.jsx(e.Fragment,{}),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:c?`${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=r=>{let{options:c,placeholder:u="Select an option",selected:p,onOptionSelected:g,resetDropdown:v,maxHeight:j,backgroundColor:O,calendarPopperConfig:m,variant:y="default",datePickerPlacement:D,closeDropdown:b}=r;var S,x,h;const[f,k]=o.useState(!1),[w,C]=o.useState(p),[R,E]=o.useState(),[q,T]=o.useState(!1),A=()=>{!f&&T(!q)},[P,L]=o.useState(p),M="small"===y?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&C(void 0)}),[v]),o.useEffect((()=>{var e;(null==p?void 0:p.isCustom)&&(null===(e=p.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?E(p.dateRangeSelectionOptions.selectedDates):E(void 0),C(p)}),[p]),o.useEffect((()=>{T(!1),k(!1)}),[b]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:q,onToggle:A,backgroundColor:O,id:"analytic-dropdown"},{children:[e.jsx(t.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===y?{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(M,Object.assign({style:"small"===y?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==w?void 0:w.isCustom)?R?d(R[0])===d(R[1])?`${d(R[0])}`:`${d(R[0])} to ${d(R[1])}`:(null==P?void 0:P.label)?null==P?void 0:P.label:u: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!=D?D:"end",id:"sub--dropdown",show:f,onToggle:e=>{!e&&T(!1),k(!f)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:j||"auto",overflowY:"scroll"}},{children:c.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:R,onClickingEachItem:e=>{C(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:R,onClickingEachItem:e=>{if(E(void 0),C(e),L(e),A(),!e.noOfDays)return void g(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),g(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==m?void 0:m.offsetSkid)||0,(null==m?void 0:m.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(S=null==w?void 0:w.dateRangeSelectionOptions)||void 0===S?void 0:S.selectRange)||!1,maxDate:null===(x=null==w?void 0:w.dateRangeSelectionOptions)||void 0===x?void 0:x.maxDate,minDate:null===(h=null==w?void 0:w.dateRangeSelectionOptions)||void 0===h?void 0:h.minDate,selectedDates:R,onSelectRange:(e,o)=>{const t=[e,o];(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=t,g(Object.assign(Object.assign({},w),{selectedRange:[e,o]}))),L(w),k(!1),E(t),T(!q)},onSelectDate:e=>{(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=[e,e],g(Object.assign(Object.assign({},w),{selectedRange:[e,e]}))),L(w),k(!1),E([e,e]),T(!q)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
@@ -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"react-calendar";import"../../utils/DateUtils.js";import{BodySecondary as c,Caption as r,BodyCaption as p}from"../TypographyStyle.js";import"../datePicker/DatePickerWrapper.styled.js";import{MainDropdown as g,ItemMenuContainer as u}from"./CommonStyles.js";const m=a=>{let{options:p,placeholder:u="Select an option",selected:m,onOptionSelected:b,resetDropdown:h,maxHeight:y,backgroundColor:f,calendarPopperConfig:D,variant:j="default",datePickerPlacement:k,closeDropdown:S}=a;var R,w,C;const[x,P]=n(!1),[$,T]=n(m),[I,N]=n(),[A,E]=n(!1),F=()=>{!x&&E(!A)},[L,H]=n(m),M="small"===j?r: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)?N(m.dateRangeSelectionOptions.selectedDates):N(void 0),T(m)}),[m]),l((()=>{E(!1),P(!1)}),[S]),e(o,{children:t(g,Object.assign({drop:"down",show:A,onToggle:F,backgroundColor:f,id:"analytic-dropdown"},{children:[e(i.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===j?{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"===j?{color:s.colorsV2.content.secondary}:void 0},{children:(null==$?void 0:$.isCustom)?I?O(I[0])===O(I[1])?`${O(I[0])}`:`${O(I[0])} to ${O(I[1])}`:(null==L?void 0:L.label)?null==L?void 0:L.label:u:$?null==$?void 0:$.label:u}))})),e(i.Menu,Object.assign({className:"main--dropdown"},{children:t(g,Object.assign({drop:null!=k?k:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&E(!1),P(!x)}},{children:[e("div",Object.assign({style:{maxHeight:y||"auto",overflowY:"scroll"}},{children:p.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:$,selectedDate:I,onClickingEachItem:e=>{T(e),P(!0)},rangeSelection:!!(null===(t=null==o?void 0:o.dateRangeSelectionOptions)||void 0===t?void 0:t.selectRange)})})):e(v,{eachOption:o,selectedOption:$,selectedDate:I,onClickingEachItem:e=>{if(N(void 0),T(e),H(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==D?void 0:D.offsetSkid)||0,(null==D?void 0:D.offsetDistance)||0]}}]}},{children:e(d,{selectRange:(null===(R=null==$?void 0:$.dateRangeSelectionOptions)||void 0===R?void 0:R.selectRange)||!1,maxDate:null===(w=null==$?void 0:$.dateRangeSelectionOptions)||void 0===w?void 0:w.maxDate,minDate:null===(C=null==$?void 0:$.dateRangeSelectionOptions)||void 0===C?void 0:C.minDate,selectedDates:I,onSelectRange:(e,o)=>{const t=[e,o];(null==$?void 0:$.dateRangeSelectionOptions)&&($.dateRangeSelectionOptions.selectedDates=t,b(Object.assign(Object.assign({},$),{selectedRange:[e,o]}))),H($),P(!1),N(t),E(!A)},onSelectDate:e=>{(null==$?void 0:$.dateRangeSelectionOptions)&&($.dateRangeSelectionOptions.selectedDates=[e,e],b(Object.assign(Object.assign({},$),{selectedRange:[e,e]}))),H($),P(!1),N([e,e]),E(!A)}})}))]}))}))]}))})},v=n=>{let{eachOption:l,selectedOption:i,selectedDate:s,onClickingEachItem:d,rangeSelection:g}=n;return t(u,Object.assign({onClick:()=>d(l),isSelected:l.isCustom?l.key==(null==i?void 0:i.key)&&!!s:l.key==(null==i?void 0:i.key)},{children:[e(c,Object.assign({color:l.key==(null==i?void 0:i.key)?a.positive[900]:a.grayscale[900]},{children:l.label})),l.subLabel?e(r,Object.assign({style:{color:"#616161"}},{children:l.subLabel})):e(o,{}),s&&(null==i?void 0:i.isCustom)&&l.key==(null==i?void 0:i.key)&&e(p,{children:g?`${O(s[0])} to ${O(s[1])}`:`${O(s[0])}`})]}),l.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 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 a,BASE_COLORS as s}from"../../constants/Theme.js";import{DatePicker as d}from"../datePicker/DatePicker.js";import"react-calendar";import"../../utils/DateUtils.js";import{BodySecondary as c,BodyCaption as r,Caption as g}from"../TypographyStyle.js";import"../datePicker/DatePickerWrapper.styled.js";import{MainDropdown as p,ItemMenuContainer as u}from"./CommonStyles.js";const m=s=>{let{options:r,placeholder:u="Select an option",selected:m,onOptionSelected:b,resetDropdown:h,maxHeight:y,backgroundColor:f,calendarPopperConfig:D,variant:j="default",datePickerPlacement:k,closeDropdown:S}=s;var R,w,C;const[x,P]=n(!1),[$,T]=n(m),[I,N]=n(),[A,E]=n(!1),F=()=>{!x&&E(!A)},[L,H]=n(m),M="small"===j?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)?N(m.dateRangeSelectionOptions.selectedDates):N(void 0),T(m)}),[m]),l((()=>{E(!1),P(!1)}),[S]),e(o,{children:t(p,Object.assign({drop:"down",show:A,onToggle:F,backgroundColor:f,id:"analytic-dropdown"},{children:[e(i.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===j?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${a.colorsV2.stroke.primary}`}:void 0},{children:e(M,Object.assign({style:"small"===j?{color:a.colorsV2.content.secondary}:void 0},{children:(null==$?void 0:$.isCustom)?I?O(I[0])===O(I[1])?`${O(I[0])}`:`${O(I[0])} to ${O(I[1])}`:(null==L?void 0:L.label)?null==L?void 0:L.label:u:$?null==$?void 0:$.label:u}))})),e(i.Menu,Object.assign({className:"main--dropdown"},{children:t(p,Object.assign({drop:null!=k?k:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&E(!1),P(!x)}},{children:[e("div",Object.assign({style:{maxHeight:y||"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:$,selectedDate:I,onClickingEachItem:e=>{T(e),P(!0)},rangeSelection:!!(null===(t=null==o?void 0:o.dateRangeSelectionOptions)||void 0===t?void 0:t.selectRange)})})):e(v,{eachOption:o,selectedOption:$,selectedDate:I,onClickingEachItem:e=>{if(N(void 0),T(e),H(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==D?void 0:D.offsetSkid)||0,(null==D?void 0:D.offsetDistance)||0]}}]}},{children:e(d,{selectRange:(null===(R=null==$?void 0:$.dateRangeSelectionOptions)||void 0===R?void 0:R.selectRange)||!1,maxDate:null===(w=null==$?void 0:$.dateRangeSelectionOptions)||void 0===w?void 0:w.maxDate,minDate:null===(C=null==$?void 0:$.dateRangeSelectionOptions)||void 0===C?void 0:C.minDate,selectedDates:I,onSelectRange:(e,o)=>{const t=[e,o];(null==$?void 0:$.dateRangeSelectionOptions)&&($.dateRangeSelectionOptions.selectedDates=t,b(Object.assign(Object.assign({},$),{selectedRange:[e,o]}))),H($),P(!1),N(t),E(!A)},onSelectDate:e=>{(null==$?void 0:$.dateRangeSelectionOptions)&&($.dateRangeSelectionOptions.selectedDates=[e,e],b(Object.assign(Object.assign({},$),{selectedRange:[e,e]}))),H($),P(!1),N([e,e]),E(!A)}})}))]}))}))]}))})},v=n=>{let{eachOption:l,selectedOption:i,selectedDate:a,onClickingEachItem:d,rangeSelection:g}=n;return t(u,Object.assign({onClick:()=>d(l),isSelected:l.isCustom?l.key==(null==i?void 0:i.key)&&!!a:l.key==(null==i?void 0:i.key)},{children:[e(c,Object.assign({color:l.key==(null==i?void 0:i.key)?s.positive[900]:s.grayscale[900]},{children:l.label})),l.subLabel?e(r,Object.assign({style:{color:s.grayscale[700]}},{children:l.subLabel})):e(o,{}),a&&(null==i?void 0:i.isCustom)&&l.key==(null==i?void 0:i.key)&&e(r,{children:g?`${O(a[0])} to ${O(a[1])}`:`${O(a[0])}`})]}),l.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.518-subtext-beta.0",
3
+ "version": "0.0.518-subtext-beta.1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",