@bikdotai/bik-component-library 0.0.266 → 0.0.267
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/components/accordion/Accordion.d.ts +0 -1
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +6 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/accordion/Accordion.d.ts +0 -1
- package/dist/esm/components/accordion/Accordion.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +6 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -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("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=o=>{var s;const[a,c]=r.useState(!1),l=r.useRef(null),d=r.useRef(null),u=(e,r)=>{d.current&&l.current&&(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=o=>{var s;const[a,c]=r.useState(!1),l=r.useRef(null),d=r.useRef(null),u=(e,r)=>{d.current&&l.current&&("keydown"===r.type&&"Enter"!==r.key||(c(e),d.current.style.maxHeight?(d.current.style.maxHeight="",l.current.style.transform="rotate(0deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="padding 0s"):(d.current.style.maxHeight=d.current.scrollHeight+"px",l.current.style.transform="rotate(180deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="max-height 0.25s ease-in-out")))};return r.useEffect((()=>{var e;a&&(null==o?void 0:o.refresh)&&(null===(e=null==d?void 0:d.current)||void 0===e?void 0:e.scrollHeight)&&setTimeout((()=>{d.current.style.maxHeight=d.current.scrollHeight+"px"}),100)}),[a,null==o?void 0:o.refresh,null===(s=null==d?void 0:d.current)||void 0===s?void 0:s.scrollHeight]),e.jsxs(n.default,Object.assign({className:"accordion",isActive:a,width:null==o?void 0:o.width,contentMargin:null==o?void 0:o.contentMargin,headerPadding:o.headerPadding,skipHoverState:o.skipHoverHeader,showBorders:o.showBorders,backgroundColor:o.backgroundColor},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(a?"active":""),onClick:e=>u(!a,e),onKeyDown:e=>u(!a,e),role:"button",tabIndex:0},{children:[!o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header,e.jsx(i.default,{isNewIcon:!1,ref:l})]})),o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:[e.jsxs("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[e.jsx(i.default,{isNewIcon:!0,ref:l}),"string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header]})),e.jsx("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:o.rightActionComponent}))]})),(null==o?void 0:o.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:o.caption})}))]})),e.jsx("div",Object.assign({ref:d,className:"accordion__content"},{children:o.children}))]}))};
|
|
@@ -22,7 +22,12 @@ export interface AnalyticsDropdownInterface {
|
|
|
22
22
|
onOptionSelected: (chosen: DropdownOptions & {
|
|
23
23
|
selectedRange?: [Date, Date];
|
|
24
24
|
}) => void;
|
|
25
|
+
maxHeight?: string;
|
|
25
26
|
backgroundColor?: string;
|
|
27
|
+
calendarPopperConfig?: {
|
|
28
|
+
offsetSkid?: number;
|
|
29
|
+
offsetDistance?: number;
|
|
30
|
+
};
|
|
26
31
|
}
|
|
27
32
|
export declare const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface>;
|
|
28
33
|
export declare const EachItem: React.FC<{
|
|
@@ -30,5 +35,6 @@ export declare const EachItem: React.FC<{
|
|
|
30
35
|
selectedOption: DropdownOptions | undefined;
|
|
31
36
|
selectedDate: Date[] | undefined;
|
|
32
37
|
onClickingEachItem: (optionSelected: DropdownOptions) => void;
|
|
38
|
+
rangeSelection?: boolean;
|
|
33
39
|
}>;
|
|
34
40
|
export declare const formatDate: (dateVal: Date) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("react-bootstrap"),o=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=t=>{let{eachOption:n,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=t;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(n),isSelected:n.isCustom?n.key==(null==s?void 0:s.key)&&!!a:n.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:n.key==(null==s?void 0:s.key)?o.BASE_COLORS.positive[900]:o.BASE_COLORS.grayscale[900]},{children:n.label})),a&&(null==s?void 0:s.isCustom)&&n.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),n.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=o=>{let{options:c,placeholder:r="Select an option",selected:u,onOptionSelected:g,resetDropdown:p,maxHeight:v,backgroundColor:O,calendarPopperConfig:j}=o;var m,S,D;const[h,y]=t.useState(!1),[b,x]=t.useState(u),[f,k]=t.useState(),[w,R]=t.useState(!1),C=()=>{!h&&R(!w)},[E,q]=t.useState(u);return t.useEffect((()=>{p&&x(void 0)}),[p]),t.useEffect((()=>{var e;(null==u?void 0:u.isCustom)&&(null===(e=u.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?k(u.dateRangeSelectionOptions.selectedDates):u&&x(u)}),[u]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:w,onToggle:C,backgroundColor:O},{children:[e.jsx(n.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown"},{children:e.jsx(i.BodySecondary,{children:(null==b?void 0:b.isCustom)?f?d(f[0])===d(f[1])?`${d(f[0])}`:`${d(f[0])} to ${d(f[1])}`:null==E?void 0:E.label:b?null==b?void 0:b.label:r})})),e.jsx(n.Dropdown.Menu,Object.assign({className:"main--dropdown"},{children:e.jsxs(l.MainDropdown,Object.assign({drop:"end",id:"sub--dropdown",show:h,onToggle:e=>{!e&&R(!1),y(!h)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:v||"auto",overflowY:"scroll"}},{children:c.map((t=>{var o;return e.jsx("div",{children:(null==t?void 0:t.isCustom)?e.jsx(n.Dropdown.Toggle,Object.assign({className:"sub--dropdown"},{children:e.jsx(a,{eachOption:t,selectedOption:b,selectedDate:f,onClickingEachItem:e=>{x(e),y(!0)},rangeSelection:!!(null===(o=null==t?void 0:t.dateRangeSelectionOptions)||void 0===o?void 0:o.selectRange)})})):e.jsx(a,{eachOption:t,selectedOption:b,selectedDate:f,onClickingEachItem:e=>{if(x(e),q(e),C(),!e.noOfDays)return void g(e);const t=new Date,n=new Date;n.setDate(t.getDate()-e.noOfDays),g(Object.assign(Object.assign({},e),{selectedRange:[n,t]}))}})},null==t?void 0:t.key)}))})),e.jsx(n.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===(m=null==b?void 0:b.dateRangeSelectionOptions)||void 0===m?void 0:m.selectRange)||!1,maxDate:null===(S=null==b?void 0:b.dateRangeSelectionOptions)||void 0===S?void 0:S.maxDate,minDate:null===(D=null==b?void 0:b.dateRangeSelectionOptions)||void 0===D?void 0:D.minDate,selectedDates:f,onSelectRange:(e,t)=>{const n=[e,t];(null==b?void 0:b.dateRangeSelectionOptions)&&(b.dateRangeSelectionOptions.selectedDates=n,g(Object.assign(Object.assign({},b),{selectedRange:[e,t]}))),q(b),y(!1),k(n),R(!w)},onSelectDate:e=>{(null==b?void 0:b.dateRangeSelectionOptions)&&(b.dateRangeSelectionOptions.selectedDates=[e,e],g(Object.assign(Object.assign({},b),{selectedRange:[e,e]}))),q(b),y(!1),k([e,e]),R(!w)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t,useEffect as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t,useEffect as o}from"react";import{TitleRegular as i,BodySecondary as c}from"../TypographyStyle.js";import a from"./Accordion.style.js";import s from"./AccordionArrow.js";const l=l=>{var d;const[h,u]=n(!1),v=t(null),g=t(null),m=(e,r)=>{g.current&&v.current&&("keydown"===r.type&&"Enter"!==r.key||(u(e),g.current.style.maxHeight?(g.current.style.maxHeight="",v.current.style.transform="rotate(0deg)",v.current.style.transition="transform 0.25s ease-in-out",g.current.style.transition="padding 0s"):(g.current.style.maxHeight=g.current.scrollHeight+"px",v.current.style.transform="rotate(180deg)",v.current.style.transition="transform 0.25s ease-in-out",g.current.style.transition="max-height 0.25s ease-in-out")))};return o((()=>{var e;h&&(null==l?void 0:l.refresh)&&(null===(e=null==g?void 0:g.current)||void 0===e?void 0:e.scrollHeight)&&setTimeout((()=>{g.current.style.maxHeight=g.current.scrollHeight+"px"}),100)}),[h,null==l?void 0:l.refresh,null===(d=null==g?void 0:g.current)||void 0===d?void 0:d.scrollHeight]),e(a,Object.assign({className:"accordion",isActive:h,width:null==l?void 0:l.width,contentMargin:null==l?void 0:l.contentMargin,headerPadding:l.headerPadding,skipHoverState:l.skipHoverHeader,showBorders:l.showBorders,backgroundColor:l.backgroundColor},{children:[e("div",Object.assign({className:"accordion__overview "+(h?"active":""),onClick:e=>m(!h,e),onKeyDown:e=>m(!h,e),role:"button",tabIndex:0},{children:[!l.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof l.header?r(i,{children:null==l?void 0:l.header}):l.header,r(s,{isNewIcon:!1,ref:v})]})),l.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(s,{isNewIcon:!0,ref:v}),"string"==typeof l.header?r(i,{children:null==l?void 0:l.header}):l.header]})),r("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:l.rightActionComponent}))]})),(null==l?void 0:l.caption)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(c,{children:l.caption})}))]})),r("div",Object.assign({ref:g,className:"accordion__content"},{children:l.children}))]}))};export{l as BikAccordion};
|
|
@@ -22,7 +22,12 @@ export interface AnalyticsDropdownInterface {
|
|
|
22
22
|
onOptionSelected: (chosen: DropdownOptions & {
|
|
23
23
|
selectedRange?: [Date, Date];
|
|
24
24
|
}) => void;
|
|
25
|
+
maxHeight?: string;
|
|
25
26
|
backgroundColor?: string;
|
|
27
|
+
calendarPopperConfig?: {
|
|
28
|
+
offsetSkid?: number;
|
|
29
|
+
offsetDistance?: number;
|
|
30
|
+
};
|
|
26
31
|
}
|
|
27
32
|
export declare const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface>;
|
|
28
33
|
export declare const EachItem: React.FC<{
|
|
@@ -30,5 +35,6 @@ export declare const EachItem: React.FC<{
|
|
|
30
35
|
selectedOption: DropdownOptions | undefined;
|
|
31
36
|
selectedDate: Date[] | undefined;
|
|
32
37
|
onClickingEachItem: (optionSelected: DropdownOptions) => void;
|
|
38
|
+
rangeSelection?: boolean;
|
|
33
39
|
}>;
|
|
34
40
|
export declare const formatDate: (dateVal: Date) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as o,jsxs as n}from"react/jsx-runtime";import{useState as t,useEffect as i}from"react";import{Dropdown as l}from"react-bootstrap";import{BASE_COLORS as s}from"../../constants/Theme.js";import{DatePicker as a}from"../datePicker/DatePicker.js";import{BodySecondary as d,BodyCaption as c}from"../TypographyStyle.js";import{MainDropdown as r,ItemMenuContainer as g}from"./CommonStyles.js";const
|
|
1
|
+
import{jsx as e,Fragment as o,jsxs as n}from"react/jsx-runtime";import{useState as t,useEffect as i}from"react";import{Dropdown as l}from"react-bootstrap";import{BASE_COLORS as s}from"../../constants/Theme.js";import{DatePicker as a}from"../datePicker/DatePicker.js";import{BodySecondary as d,BodyCaption as c}from"../TypographyStyle.js";import{MainDropdown as r,ItemMenuContainer as g}from"./CommonStyles.js";const p=s=>{let{options:c,placeholder:g="Select an option",selected:p,onOptionSelected:v,resetDropdown:O,maxHeight:h,backgroundColor:b,calendarPopperConfig:f}=s;var D,S,j;const[y,k]=t(!1),[R,C]=t(p),[w,x]=t(),[T,$]=t(!1),N=()=>{!y&&$(!T)},[E,I]=t(p);return i((()=>{O&&C(void 0)}),[O]),i((()=>{var e;(null==p?void 0:p.isCustom)&&(null===(e=p.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?x(p.dateRangeSelectionOptions.selectedDates):p&&C(p)}),[p]),e(o,{children:n(r,Object.assign({drop:"down",show:T,onToggle:N,backgroundColor:b},{children:[e(l.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown"},{children:e(d,{children:(null==R?void 0:R.isCustom)?w?m(w[0])===m(w[1])?`${m(w[0])}`:`${m(w[0])} to ${m(w[1])}`:null==E?void 0:E.label:R?null==R?void 0:R.label:g})})),e(l.Menu,Object.assign({className:"main--dropdown"},{children:n(r,Object.assign({drop:"end",id:"sub--dropdown",show:y,onToggle:e=>{!e&&$(!1),k(!y)}},{children:[e("div",Object.assign({style:{maxHeight:h||"auto",overflowY:"scroll"}},{children:c.map((o=>{var n;return e("div",{children:(null==o?void 0:o.isCustom)?e(l.Toggle,Object.assign({className:"sub--dropdown"},{children:e(u,{eachOption:o,selectedOption:R,selectedDate:w,onClickingEachItem:e=>{C(e),k(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e(u,{eachOption:o,selectedOption:R,selectedDate:w,onClickingEachItem:e=>{if(C(e),I(e),N(),!e.noOfDays)return void v(e);const o=new Date,n=new Date;n.setDate(o.getDate()-e.noOfDays),v(Object.assign(Object.assign({},e),{selectedRange:[n,o]}))}})},null==o?void 0:o.key)}))})),e(l.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==f?void 0:f.offsetSkid)||0,(null==f?void 0:f.offsetDistance)||0]}}]}},{children:e(a,{selectRange:(null===(D=null==R?void 0:R.dateRangeSelectionOptions)||void 0===D?void 0:D.selectRange)||!1,maxDate:null===(S=null==R?void 0:R.dateRangeSelectionOptions)||void 0===S?void 0:S.maxDate,minDate:null===(j=null==R?void 0:R.dateRangeSelectionOptions)||void 0===j?void 0:j.minDate,selectedDates:w,onSelectRange:(e,o)=>{const n=[e,o];(null==R?void 0:R.dateRangeSelectionOptions)&&(R.dateRangeSelectionOptions.selectedDates=n,v(Object.assign(Object.assign({},R),{selectedRange:[e,o]}))),I(R),k(!1),x(n),$(!T)},onSelectDate:e=>{(null==R?void 0:R.dateRangeSelectionOptions)&&(R.dateRangeSelectionOptions.selectedDates=[e,e],v(Object.assign(Object.assign({},R),{selectedRange:[e,e]}))),I(R),k(!1),x([e,e]),$(!T)}})}))]}))}))]}))})},u=o=>{let{eachOption:t,selectedOption:i,selectedDate:l,onClickingEachItem:a,rangeSelection:r}=o;return n(g,Object.assign({onClick:()=>a(t),isSelected:t.isCustom?t.key==(null==i?void 0:i.key)&&!!l:t.key==(null==i?void 0:i.key)},{children:[e(d,Object.assign({color:t.key==(null==i?void 0:i.key)?s.positive[900]:s.grayscale[900]},{children:t.label})),l&&(null==i?void 0:i.isCustom)&&t.key==(null==i?void 0:i.key)&&e(c,{children:r?`${m(l[0])} to ${m(l[1])}`:`${m(l[0])}`})]}),t.key)},m=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});export{p as AnalyticsDropdown,u as EachItem,m as formatDate};
|