@bikdotai/bik-component-library 0.0.517-beta.drop.6 → 0.0.517-beta.drop.7
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/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +3 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +3 -0
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),n=require("../../constants/Theme.js"),r=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),s=require("../input/context/InputStyleProvider.js"),l=require("./DropdownPopover/index.js"),a=require("./OpenedDropdown/utils/iterationOnOptions.js");function d(){}const u=u=>{var c,p,h,{placeHolder:v,size:g,onSelect:j,defaultOptions:x,disabled:f,noErrorHint:b,placeHolderHeight:O}=u,w=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight"]);const[H,S]=o.useState(!1),m=null!=g?g:"default",q=o.useRef(),[y,D]=o.useState(null!=x?x:[]);o.useEffect((()=>{var e;const t=[];null===(e=null==w?void 0:w.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),D([...t])}),[w.options]),o.useEffect((()=>{x&&D([...x])}),[x]);const E=a.getSelectedOptionsAsText(y);return console.log("textVal",E),console.log("selectedOption",y),t.jsx(s.InputStyleContext.Provider,Object.assign({value:{InputWrapper:{height:O||("small"===m?32:48),width:null!==(p=null!==(c=w.buttonWidth)&&void 0!==c?c:w.width)&&void 0!==p?p:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},input:{minHeight:"100%"}}},{children:t.jsx(l.DropdownPopover,Object.assign({ref:q,onSelect:function(e){Array.isArray(e)?D([...e]):D([e]),null==j||j(e)},disabled:f,onDropdownVisbilityChange:e=>S(e)},w,{children:t.jsx(i.Input,{version:w.version,noErrorHint:b,state:f?"disabled":"none",value:null!=E?E:"",errorMessage:w.error,variant:m,placeholder:null!=v?v:"Select an option",width:null!==(h=w.width)&&void 0!==h?h:"100%",onChangeText:d,rightIcon:{icon:()=>t.jsx(r.default,{style:{transform:H?"rotate(180deg)":"rotate(0deg)"},onClick:d,width:"small"===m?20:24,height:"small"===m?20:24,color:n.COLORS.content.primary})},truncateText:!0})}))}))};u.displayName="Dropdown",exports.Dropdown=u;
|
|
@@ -12,6 +12,7 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
12
12
|
leadingIcon?: JSX.Element | undefined;
|
|
13
13
|
customComponent?: JSX.Element | undefined;
|
|
14
14
|
searchKey?: string | undefined;
|
|
15
|
+
selectedLabel?: string | undefined;
|
|
15
16
|
} | {
|
|
16
17
|
label?: string | undefined;
|
|
17
18
|
value?: string | undefined;
|
|
@@ -24,6 +25,8 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
24
25
|
leadingIcon?: JSX.Element | undefined;
|
|
25
26
|
customComponent?: JSX.Element | undefined;
|
|
26
27
|
searchKey?: string | undefined;
|
|
28
|
+
selectedLabel?: string | undefined;
|
|
27
29
|
options: SingleOption[];
|
|
28
30
|
})[];
|
|
29
31
|
export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
|
|
32
|
+
export declare function getSelectedOptionsAsText(selectedOption: DropdownOption[]): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.iterateOnOptions=function(t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSelectedOptionsAsText=function(t){if(console.log(t),t&&t.length)return t.map((t=>{var e;const n=t;return null!==(e=n.selectedLabel)&&void 0!==e?e:n.label})).join(", ")},exports.iterateOnOptions=function(t,e,n){return t.map((t=>{if(t.options){const s=t.options.map((t=>!n||n(t)?Object.assign(Object.assign({},t),e):Object.assign({},t)));return Object.assign(Object.assign({},t),{options:[...s]})}return!n||n(t)?Object.assign(Object.assign({},t),e):Object.assign({},t)}))},exports.iterateOnOptionsRaw=function(t,e){t.forEach((t=>{t.options?t.options.forEach(e):e(t)}))};
|
|
@@ -39,6 +39,7 @@ export type SingleOption = {
|
|
|
39
39
|
leadingIcon?: JSX.Element;
|
|
40
40
|
customComponent?: JSX.Element;
|
|
41
41
|
searchKey?: string;
|
|
42
|
+
selectedLabel?: string;
|
|
42
43
|
};
|
|
43
44
|
export type MultiSelectOption = SingleOption;
|
|
44
45
|
export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as r}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";function
|
|
1
|
+
import{__rest as o}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as r}from"react";import{COLORS as i}from"../../constants/Theme.js";import l from"../../assets/icons/chevronDown.svg.js";import{Input as s}from"../input/Input.js";import{InputStyleContext as a}from"../input/context/InputStyleProvider.js";import{DropdownPopover as d}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as p}from"./OpenedDropdown/utils/iterationOnOptions.js";function c(){}const u=u=>{var m,h,g,{placeHolder:f,size:v,onSelect:b,defaultOptions:j,disabled:w,noErrorHint:x,placeHolderHeight:H}=u,O=o(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight"]);const[y,D]=t(!1),E=null!=v?v:"default",I=n(),[S,z]=t(null!=j?j:[]);r((()=>{var o;const e=[];null===(o=null==O?void 0:O.options)||void 0===o||o.forEach((o=>{o.options?o.options.forEach((o=>{o.selected&&e.push(Object.assign(Object.assign({},o),{label:o.label}))})):o.selected&&e.push(o)})),z([...e])}),[O.options]),r((()=>{j&&z([...j])}),[j]);const C=p(S);return console.log("textVal",C),console.log("selectedOption",S),e(a.Provider,Object.assign({value:{InputWrapper:{height:H||("small"===E?32:48),width:null!==(h=null!==(m=O.buttonWidth)&&void 0!==m?m:O.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"6px 8px"},input:{minHeight:"100%"}}},{children:e(d,Object.assign({ref:I,onSelect:function(o){Array.isArray(o)?z([...o]):z([o]),null==b||b(o)},disabled:w,onDropdownVisbilityChange:o=>D(o)},O,{children:e(s,{version:O.version,noErrorHint:x,state:w?"disabled":"none",value:null!=C?C:"",errorMessage:O.error,variant:E,placeholder:null!=f?f:"Select an option",width:null!==(g=O.width)&&void 0!==g?g:"100%",onChangeText:c,rightIcon:{icon:()=>e(l,{style:{transform:y?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"small"===E?20:24,height:"small"===E?20:24,color:i.content.primary})},truncateText:!0})}))}))};u.displayName="Dropdown";export{u as Dropdown};
|
|
@@ -12,6 +12,7 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
12
12
|
leadingIcon?: JSX.Element | undefined;
|
|
13
13
|
customComponent?: JSX.Element | undefined;
|
|
14
14
|
searchKey?: string | undefined;
|
|
15
|
+
selectedLabel?: string | undefined;
|
|
15
16
|
} | {
|
|
16
17
|
label?: string | undefined;
|
|
17
18
|
value?: string | undefined;
|
|
@@ -24,6 +25,8 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
|
|
|
24
25
|
leadingIcon?: JSX.Element | undefined;
|
|
25
26
|
customComponent?: JSX.Element | undefined;
|
|
26
27
|
searchKey?: string | undefined;
|
|
28
|
+
selectedLabel?: string | undefined;
|
|
27
29
|
options: SingleOption[];
|
|
28
30
|
})[];
|
|
29
31
|
export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
|
|
32
|
+
export declare function getSelectedOptionsAsText(selectedOption: DropdownOption[]): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function n(n,t,s){return n.map((n=>{if(n.options){const o=n.options.map((n=>!s||s(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)));return Object.assign(Object.assign({},n),{options:[...o]})}return!s||s(n)?Object.assign(Object.assign({},n),t):Object.assign({},n)}))}function t(n,t){n.forEach((n=>{n.options?n.options.forEach(t):t(n)}))}function s(n){if(console.log(n),n&&n.length)return n.map((n=>{var t;const s=n;return null!==(t=s.selectedLabel)&&void 0!==t?t:s.label})).join(", ")}export{s as getSelectedOptionsAsText,n as iterateOnOptions,t as iterateOnOptionsRaw};
|
|
@@ -39,6 +39,7 @@ export type SingleOption = {
|
|
|
39
39
|
leadingIcon?: JSX.Element;
|
|
40
40
|
customComponent?: JSX.Element;
|
|
41
41
|
searchKey?: string;
|
|
42
|
+
selectedLabel?: string;
|
|
42
43
|
};
|
|
43
44
|
export type MultiSelectOption = SingleOption;
|
|
44
45
|
export type DropdownOption = MultiSelectOption | SingleOption | GroupedOption;
|