@onewelcome/react-lib-components 6.4.1 → 6.4.3

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,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("./useAddNewBtn.module.cjs.js");var t=require("react");function n(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var a=n(t);const d=({addNew:n,filter:d})=>{var o;const r=t.useRef(null);const s=(o=n===null||n===void 0?void 0:n.label)!==null&&o!==void 0?o:"Create new";const l=()=>n&&a["default"].createElement("button",{"data-testid":"select-action-button",className:e["default"]["action-button"],onClick:()=>n.onAddNew(d),ref:r,...n.btnProps},!d&&s,d&&a["default"].createElement("span",{style:{fontWeight:"700"}},`"${d}"`),d&&` (${s.toLowerCase()})`);const u=n?e["default"]["has-sibling"]:"";return{addNewBtnOptionsContainerClassName:u,renderAddNew:l,addBtnRef:r}};exports.useAddNewBtn=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("./useAddNewBtn.module.cjs.js");var t=require("react");function n(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var a=n(t);const o=({addNew:n,filter:o})=>{var d;const r=t.useRef(null);const s=(d=n===null||n===void 0?void 0:n.label)!==null&&d!==void 0?d:"Create new";const l=()=>n&&a["default"].createElement("button",{"data-testid":"select-action-button",className:e["default"]["action-button"],onClick:()=>n.onAddNew(o),ref:r,type:"button",...n.btnProps},!o&&s,o&&a["default"].createElement("span",{style:{fontWeight:"700"}},`"${o}"`),o&&` (${s.toLowerCase()})`);const u=n?e["default"]["has-sibling"]:"";return{addNewBtnOptionsContainerClassName:u,renderAddNew:l,addBtnRef:r}};exports.useAddNewBtn=o;
2
2
  //# sourceMappingURL=useAddNewBtn.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAddNewBtn.cjs.js","sources":["../../../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\n\ninterface Props {\n addNew?: AddNewProps;\n filter: string;\n}\n\nexport const useAddNewBtn = ({ addNew, filter }: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n\n const addNewLabel = addNew?.label ?? \"Create new\";\n\n const renderAddNew = () =>\n addNew && (\n <button\n data-testid={\"select-action-button\"}\n className={classes[\"action-button\"]}\n onClick={() => addNew.onAddNew(filter)}\n ref={addBtnRef}\n {...addNew.btnProps}\n >\n {!filter && addNewLabel}\n {filter && <span style={{ fontWeight: \"700\" }}>{`\"${filter}\"`}</span>}\n {filter && ` (${addNewLabel.toLowerCase()})`}\n </button>\n );\n\n const addNewBtnOptionsContainerClassName = addNew ? classes[\"has-sibling\"] : \"\";\n\n return {\n addNewBtnOptionsContainerClassName,\n renderAddNew,\n addBtnRef\n };\n};\n"],"names":["useAddNewBtn","addNew","filter","addBtnRef","useRef","addNewLabel","_a","label","renderAddNew","React","createElement","className","classes","onClick","onAddNew","ref","btnProps","style","fontWeight","toLowerCase","addNewBtnOptionsContainerClassName"],"mappings":"+NA0Ba,MAAAA,EAAe,EAAGC,SAAQC,mBACrC,MAAMC,EAAYC,SAA0B,MAE5C,MAAMC,GAAcC,EAAAL,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQM,SAAS,MAAAD,SAAA,EAAAA,EAAA,aAErC,MAAME,EAAe,IACnBP,GACEQ,aACeC,cAAA,SAAA,CAAA,cAAA,uBACbC,UAAWC,EAAO,WAAC,iBACnBC,QAAS,IAAMZ,EAAOa,SAASZ,GAC/Ba,IAAKZ,KACDF,EAAOe,WAETd,GAAUG,EACXH,GAAUO,EAAAA,WAAAC,cAAA,OAAA,CAAMO,MAAO,CAAEC,WAAY,QAAU,IAAIhB,MACnDA,GAAU,KAAKG,EAAYc,kBAIlC,MAAMC,EAAqCnB,EAASW,EAAO,WAAC,eAAiB,GAE7E,MAAO,CACLQ,qCACAZ,eACAL,YACD"}
1
+ {"version":3,"file":"useAddNewBtn.cjs.js","sources":["../../../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\n\ninterface Props {\n addNew?: AddNewProps;\n filter: string;\n}\n\nexport const useAddNewBtn = ({ addNew, filter }: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n\n const addNewLabel = addNew?.label ?? \"Create new\";\n\n const renderAddNew = () =>\n addNew && (\n <button\n data-testid={\"select-action-button\"}\n className={classes[\"action-button\"]}\n onClick={() => addNew.onAddNew(filter)}\n ref={addBtnRef}\n type=\"button\"\n {...addNew.btnProps}\n >\n {!filter && addNewLabel}\n {filter && <span style={{ fontWeight: \"700\" }}>{`\"${filter}\"`}</span>}\n {filter && ` (${addNewLabel.toLowerCase()})`}\n </button>\n );\n\n const addNewBtnOptionsContainerClassName = addNew ? classes[\"has-sibling\"] : \"\";\n\n return {\n addNewBtnOptionsContainerClassName,\n renderAddNew,\n addBtnRef\n };\n};\n"],"names":["useAddNewBtn","addNew","filter","addBtnRef","useRef","addNewLabel","_a","label","renderAddNew","React","createElement","className","classes","onClick","onAddNew","ref","type","btnProps","style","fontWeight","toLowerCase","addNewBtnOptionsContainerClassName"],"mappings":"+NA0Ba,MAAAA,EAAe,EAAGC,SAAQC,mBACrC,MAAMC,EAAYC,SAA0B,MAE5C,MAAMC,GAAcC,EAAAL,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQM,SAAS,MAAAD,SAAA,EAAAA,EAAA,aAErC,MAAME,EAAe,IACnBP,GACEQ,EAAAA,WAAAC,cAAA,SAAA,CAAA,cACe,uBACbC,UAAWC,EAAO,WAAC,iBACnBC,QAAS,IAAMZ,EAAOa,SAASZ,GAC/Ba,IAAKZ,EACLa,KAAK,YACDf,EAAOgB,WAETf,GAAUG,EACXH,GAAUO,EAAAA,WAAAC,cAAA,OAAA,CAAMQ,MAAO,CAAEC,WAAY,QAAU,IAAIjB,MACnDA,GAAU,KAAKG,EAAYe,kBAIlC,MAAMC,EAAqCpB,EAASW,EAAO,WAAC,eAAiB,GAE7E,MAAO,CACLS,qCACAb,eACAL,YACD"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var r=require("../Input/Input.cjs.js");function o(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var s=o(e);const l=({search:o,optionsCount:l,searchPlaceholder:n,searchInputProps:t,searchInputClassName:u,expanded:a,setFocusedSelectItem:d})=>{var i,c;const[v,p]=e.useState("");const[h,f]=e.useState(false);const I=10;const P=e.useRef(null);const m=(i=o===null||o===void 0?void 0:o.renderThreshold)!==null&&i!==void 0?i:I;const S=l>m;const b=e=>{p(e.currentTarget.value)};const y=()=>{if(o===null||o===void 0?void 0:o.enabled)return S;if(o)return o.enabled;return l>I};const N=()=>{var e,l,d,i,c,v,p;return s["default"].createElement(r.Input,{...(l=(e=o===null||o===void 0?void 0:o.searchInputProps)!==null&&e!==void 0?e:t)!==null&&l!==void 0?l:{},ref:P,onFocus:()=>f(true),onBlur:()=>f(false),onChange:b,className:u,wrapperProps:{className:(c=(i=(d=o===null||o===void 0?void 0:o.searchInputProps)===null||d===void 0?void 0:d.wrapperProps)===null||i===void 0?void 0:i.className)!==null&&c!==void 0?c:(v=t===null||t===void 0?void 0:t.wrapperProps)===null||v===void 0?void 0:v.className},style:{display:a?"block":"none"},type:"text",name:"search-option",placeholder:(p=o===null||o===void 0?void 0:o.searchPlaceholder)!==null&&p!==void 0?p:n})};const g=()=>{p("");f(false);d(-1)};const j=y();e.useEffect((()=>{var e;(((e=o===null||o===void 0?void 0:o.searchInputProps)===null||e===void 0?void 0:e.reset)||(t===null||t===void 0?void 0:t.reset))&&g()}),[t===null||t===void 0?void 0:t.reset,(c=o===null||o===void 0?void 0:o.searchInputProps)===null||c===void 0?void 0:c.reset]);e.useEffect((()=>{const e=!j&&!h;if(e)g()}),[h,j]);return{renderSearch:N,setIsSearching:f,searchVisible:j,searchThreshold:m,searchInputRef:P,filter:v,isSearching:h}};exports.useSearch=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var r=require("../Input/Input.cjs.js");function o(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var s=o(e);const l=({search:o,optionsCount:l,searchPlaceholder:n,searchInputProps:t,searchInputClassName:u,expanded:a,setFocusedSelectItem:d})=>{var i,c;const[v,p]=e.useState("");const[h,f]=e.useState(false);const I=10;const P=e.useRef(null);const m=(i=o===null||o===void 0?void 0:o.renderThreshold)!==null&&i!==void 0?i:I;const S=l>=m;const b=e=>{p(e.currentTarget.value)};const y=()=>{if(o===null||o===void 0?void 0:o.enabled)return S;if(o)return o.enabled;return l>I};const N=()=>{var e,l,d,i,c,v,p;return s["default"].createElement(r.Input,{...(l=(e=o===null||o===void 0?void 0:o.searchInputProps)!==null&&e!==void 0?e:t)!==null&&l!==void 0?l:{},ref:P,onFocus:()=>f(true),onBlur:()=>f(false),onChange:b,className:u,wrapperProps:{className:(c=(i=(d=o===null||o===void 0?void 0:o.searchInputProps)===null||d===void 0?void 0:d.wrapperProps)===null||i===void 0?void 0:i.className)!==null&&c!==void 0?c:(v=t===null||t===void 0?void 0:t.wrapperProps)===null||v===void 0?void 0:v.className},style:{display:a?"block":"none"},type:"text",name:"search-option",placeholder:(p=o===null||o===void 0?void 0:o.searchPlaceholder)!==null&&p!==void 0?p:n})};const g=()=>{p("");f(false);d(-1)};const j=y();e.useEffect((()=>{var e;(((e=o===null||o===void 0?void 0:o.searchInputProps)===null||e===void 0?void 0:e.reset)||(t===null||t===void 0?void 0:t.reset))&&g()}),[t===null||t===void 0?void 0:t.reset,(c=o===null||o===void 0?void 0:o.searchInputProps)===null||c===void 0?void 0:c.reset]);e.useEffect((()=>{const e=!j&&!h;if(e)g()}),[h,j]);return{renderSearch:N,setIsSearching:f,searchVisible:j,searchThreshold:m,searchInputRef:P,filter:v,isSearching:h}};exports.useSearch=l;
2
2
  //# sourceMappingURL=useSearch.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSearch.cjs.js","sources":["../../../../../../src/components/Form/Select/useSearch.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { PartialInputProps, SearchProps } from \"./Select.interfaces\";\nimport { Input } from \"../Input/Input\";\n\ninterface Props {\n search?: SearchProps;\n optionsCount: number;\n /**\n * @deprecated\n */\n searchPlaceholder?: string;\n /**\n * @deprecated\n */\n searchInputProps?: PartialInputProps & { reset?: boolean };\n searchInputClassName: string;\n expanded: boolean;\n setFocusedSelectItem: (idx: number) => void;\n}\n\nexport const useSearch = ({\n search,\n optionsCount,\n searchPlaceholder,\n searchInputProps,\n searchInputClassName,\n expanded,\n setFocusedSelectItem\n}: Props) => {\n const [filter, setFilter] = useState(\"\");\n const [isSearching, setIsSearching] = useState(false);\n\n const DEFAULT_RENDER_THRESHOLD = 10;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n const threshold = search?.renderThreshold ?? DEFAULT_RENDER_THRESHOLD;\n const hasEnoughChildren = optionsCount > threshold;\n\n const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {\n setFilter(event.currentTarget.value);\n };\n\n const shouldRenderSearch = () => {\n if (search?.enabled) {\n return hasEnoughChildren;\n }\n\n if (search) {\n return search.enabled as boolean;\n }\n\n return optionsCount > DEFAULT_RENDER_THRESHOLD;\n };\n\n const renderSearch = () => (\n <Input\n {...(search?.searchInputProps ?? searchInputProps ?? {})}\n ref={searchInputRef}\n onFocus={() => setIsSearching(true)}\n onBlur={() => setIsSearching(false)}\n onChange={filterResults}\n className={searchInputClassName}\n wrapperProps={{\n className:\n search?.searchInputProps?.wrapperProps?.className ??\n searchInputProps?.wrapperProps?.className\n }}\n style={{\n display: expanded ? \"block\" : \"none\"\n }}\n type=\"text\"\n name=\"search-option\"\n placeholder={search?.searchPlaceholder ?? searchPlaceholder}\n />\n );\n\n const resetSearchState = () => {\n setFilter(\"\");\n setIsSearching(false);\n setFocusedSelectItem(-1);\n };\n\n const visible = shouldRenderSearch();\n\n useEffect(() => {\n (search?.searchInputProps?.reset || searchInputProps?.reset) && resetSearchState();\n }, [searchInputProps?.reset, search?.searchInputProps?.reset]);\n\n useEffect(() => {\n const searchDeactivated =\n !visible &&\n !isSearching; /*solves issue in MultiSelect when we filtered result and selected result causes list to be shorter than threshold so still we have a filter applied but can't change it due to `visible` variable has false */\n if (searchDeactivated) {\n resetSearchState();\n }\n }, [isSearching, visible]);\n\n return {\n renderSearch,\n setIsSearching,\n searchVisible: visible,\n searchThreshold: threshold,\n searchInputRef,\n filter,\n isSearching\n };\n};\n"],"names":["useSearch","search","optionsCount","searchPlaceholder","searchInputProps","searchInputClassName","expanded","setFocusedSelectItem","filter","setFilter","useState","isSearching","setIsSearching","DEFAULT_RENDER_THRESHOLD","searchInputRef","useRef","threshold","_a","renderThreshold","hasEnoughChildren","filterResults","event","currentTarget","value","shouldRenderSearch","enabled","renderSearch","React","createElement","Input","_b","ref","onFocus","onBlur","onChange","className","wrapperProps","_e","_d","_c","_f","style","display","type","name","placeholder","_g","resetSearchState","visible","useEffect","reset","searchDeactivated","searchVisible","searchThreshold"],"mappings":"8NAoCaA,EAAY,EACvBC,SACAC,eACAC,oBACAC,mBACAC,uBACAC,WACAC,mCAEA,MAAOC,EAAQC,GAAaC,EAAQA,SAAC,IACrC,MAAOC,EAAaC,GAAkBF,EAAQA,SAAC,OAE/C,MAAMG,EAA2B,GAEjC,MAAMC,EAAiBC,SAAyB,MAEhD,MAAMC,GAAYC,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQiB,mBAAmB,MAAAD,SAAA,EAAAA,EAAAJ,EAC7C,MAAMM,EAAoBjB,EAAec,EAEzC,MAAMI,EAAiBC,IACrBZ,EAAUY,EAAMC,cAAcC,MAAM,EAGtC,MAAMC,EAAqB,KACzB,GAAIvB,UAAAA,SAAM,OAAA,EAANA,EAAQwB,QACV,OAAON,EAGT,GAAIlB,EACF,OAAOA,EAAOwB,QAGhB,OAAOvB,EAAeW,CAAwB,EAGhD,MAAMa,EAAe,uBAAM,OACzBC,EAAC,WAAAC,cAAAC,QACK,QAACZ,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQG,oBAAgB,MAAAa,SAAA,EAAAA,EAAIb,KAAgB,MAAA0B,SAAA,EAAAA,EAAI,CAAA,EACrDC,IAAKjB,EACLkB,QAAS,IAAMpB,EAAe,MAC9BqB,OAAQ,IAAMrB,EAAe,OAC7BsB,SAAUd,EACVe,UAAW9B,EACX+B,aAAc,CACZD,WACEE,GAAAC,GAAAC,EAAAtC,UAAAA,SAAM,OAAA,EAANA,EAAQG,oBAAgB,MAAAmC,SAAA,OAAA,EAAAA,EAAEH,gBAAc,MAAAE,SAAA,OAAA,EAAAA,EAAAH,aACxC,MAAAE,SAAA,EAAAA,GAAAG,EAAApC,IAAgB,MAAhBA,SAAgB,OAAA,EAAhBA,EAAkBgC,gBAAY,MAAAI,SAAA,OAAA,EAAAA,EAAEL,WAEpCM,MAAO,CACLC,QAASpC,EAAW,QAAU,QAEhCqC,KAAK,OACLC,KAAK,gBACLC,aAAaC,EAAA7C,IAAA,MAAAA,kBAAAA,EAAQE,qBAAqB,MAAA2C,SAAA,EAAAA,EAAA3C,GAE7C,EAED,MAAM4C,EAAmB,KACvBtC,EAAU,IACVG,EAAe,OACfL,GAAsB,EAAE,EAG1B,MAAMyC,EAAUxB,IAEhByB,EAAAA,WAAU,cACPhC,EAAAhB,IAAA,MAAAA,kBAAAA,EAAQG,oBAAgB,MAAAa,SAAA,OAAA,EAAAA,EAAEiC,SAAS9C,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAkB8C,SAAUH,GAAkB,GACjF,CAAC3C,IAAgB,MAAhBA,SAAA,OAAA,EAAAA,EAAkB8C,OAAOpB,EAAA7B,IAAA,MAAAA,kBAAAA,EAAQG,oBAAkB,MAAA0B,SAAA,OAAA,EAAAA,EAAAoB,QAEvDD,EAAAA,WAAU,KACR,MAAME,GACHH,IACArC,EACH,GAAIwC,EACFJ,GACD,GACA,CAACpC,EAAaqC,IAEjB,MAAO,CACLtB,eACAd,iBACAwC,cAAeJ,EACfK,gBAAiBrC,EACjBF,iBACAN,SACAG,cACD"}
1
+ {"version":3,"file":"useSearch.cjs.js","sources":["../../../../../../src/components/Form/Select/useSearch.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { PartialInputProps, SearchProps } from \"./Select.interfaces\";\nimport { Input } from \"../Input/Input\";\n\ninterface Props {\n search?: SearchProps;\n optionsCount: number;\n /**\n * @deprecated\n */\n searchPlaceholder?: string;\n /**\n * @deprecated\n */\n searchInputProps?: PartialInputProps & { reset?: boolean };\n searchInputClassName: string;\n expanded: boolean;\n setFocusedSelectItem: (idx: number) => void;\n}\n\nexport const useSearch = ({\n search,\n optionsCount,\n searchPlaceholder,\n searchInputProps,\n searchInputClassName,\n expanded,\n setFocusedSelectItem\n}: Props) => {\n const [filter, setFilter] = useState(\"\");\n const [isSearching, setIsSearching] = useState(false);\n\n const DEFAULT_RENDER_THRESHOLD = 10;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n const threshold = search?.renderThreshold ?? DEFAULT_RENDER_THRESHOLD;\n const hasEnoughChildren = optionsCount >= threshold;\n\n const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {\n setFilter(event.currentTarget.value);\n };\n\n const shouldRenderSearch = () => {\n if (search?.enabled) {\n return hasEnoughChildren;\n }\n\n if (search) {\n return search.enabled as boolean;\n }\n\n return optionsCount > DEFAULT_RENDER_THRESHOLD;\n };\n\n const renderSearch = () => (\n <Input\n {...(search?.searchInputProps ?? searchInputProps ?? {})}\n ref={searchInputRef}\n onFocus={() => setIsSearching(true)}\n onBlur={() => setIsSearching(false)}\n onChange={filterResults}\n className={searchInputClassName}\n wrapperProps={{\n className:\n search?.searchInputProps?.wrapperProps?.className ??\n searchInputProps?.wrapperProps?.className\n }}\n style={{\n display: expanded ? \"block\" : \"none\"\n }}\n type=\"text\"\n name=\"search-option\"\n placeholder={search?.searchPlaceholder ?? searchPlaceholder}\n />\n );\n\n const resetSearchState = () => {\n setFilter(\"\");\n setIsSearching(false);\n setFocusedSelectItem(-1);\n };\n\n const visible = shouldRenderSearch();\n\n useEffect(() => {\n (search?.searchInputProps?.reset || searchInputProps?.reset) && resetSearchState();\n }, [searchInputProps?.reset, search?.searchInputProps?.reset]);\n\n useEffect(() => {\n const searchDeactivated =\n !visible &&\n !isSearching; /*solves issue in MultiSelect when we filtered result and selected result causes list to be shorter than threshold so still we have a filter applied but can't change it due to `visible` variable has false */\n if (searchDeactivated) {\n resetSearchState();\n }\n }, [isSearching, visible]);\n\n return {\n renderSearch,\n setIsSearching,\n searchVisible: visible,\n searchThreshold: threshold,\n searchInputRef,\n filter,\n isSearching\n };\n};\n"],"names":["useSearch","search","optionsCount","searchPlaceholder","searchInputProps","searchInputClassName","expanded","setFocusedSelectItem","filter","setFilter","useState","isSearching","setIsSearching","DEFAULT_RENDER_THRESHOLD","searchInputRef","useRef","threshold","_a","renderThreshold","hasEnoughChildren","filterResults","event","currentTarget","value","shouldRenderSearch","enabled","renderSearch","React","createElement","Input","_b","ref","onFocus","onBlur","onChange","className","wrapperProps","_e","_d","_c","_f","style","display","type","name","placeholder","_g","resetSearchState","visible","useEffect","reset","searchDeactivated","searchVisible","searchThreshold"],"mappings":"8NAoCaA,EAAY,EACvBC,SACAC,eACAC,oBACAC,mBACAC,uBACAC,WACAC,mCAEA,MAAOC,EAAQC,GAAaC,EAAQA,SAAC,IACrC,MAAOC,EAAaC,GAAkBF,EAAQA,SAAC,OAE/C,MAAMG,EAA2B,GAEjC,MAAMC,EAAiBC,SAAyB,MAEhD,MAAMC,GAAYC,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQiB,mBAAmB,MAAAD,SAAA,EAAAA,EAAAJ,EAC7C,MAAMM,EAAoBjB,GAAgBc,EAE1C,MAAMI,EAAiBC,IACrBZ,EAAUY,EAAMC,cAAcC,MAAM,EAGtC,MAAMC,EAAqB,KACzB,GAAIvB,UAAAA,SAAM,OAAA,EAANA,EAAQwB,QACV,OAAON,EAGT,GAAIlB,EACF,OAAOA,EAAOwB,QAGhB,OAAOvB,EAAeW,CAAwB,EAGhD,MAAMa,EAAe,uBAAM,OACzBC,EAAC,WAAAC,cAAAC,QACK,QAACZ,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQG,oBAAgB,MAAAa,SAAA,EAAAA,EAAIb,KAAgB,MAAA0B,SAAA,EAAAA,EAAI,CAAA,EACrDC,IAAKjB,EACLkB,QAAS,IAAMpB,EAAe,MAC9BqB,OAAQ,IAAMrB,EAAe,OAC7BsB,SAAUd,EACVe,UAAW9B,EACX+B,aAAc,CACZD,WACEE,GAAAC,GAAAC,EAAAtC,UAAAA,SAAM,OAAA,EAANA,EAAQG,oBAAgB,MAAAmC,SAAA,OAAA,EAAAA,EAAEH,gBAAc,MAAAE,SAAA,OAAA,EAAAA,EAAAH,aACxC,MAAAE,SAAA,EAAAA,GAAAG,EAAApC,IAAgB,MAAhBA,SAAgB,OAAA,EAAhBA,EAAkBgC,gBAAY,MAAAI,SAAA,OAAA,EAAAA,EAAEL,WAEpCM,MAAO,CACLC,QAASpC,EAAW,QAAU,QAEhCqC,KAAK,OACLC,KAAK,gBACLC,aAAaC,EAAA7C,IAAA,MAAAA,kBAAAA,EAAQE,qBAAqB,MAAA2C,SAAA,EAAAA,EAAA3C,GAE7C,EAED,MAAM4C,EAAmB,KACvBtC,EAAU,IACVG,EAAe,OACfL,GAAsB,EAAE,EAG1B,MAAMyC,EAAUxB,IAEhByB,EAAAA,WAAU,cACPhC,EAAAhB,IAAA,MAAAA,kBAAAA,EAAQG,oBAAgB,MAAAa,SAAA,OAAA,EAAAA,EAAEiC,SAAS9C,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAkB8C,SAAUH,GAAkB,GACjF,CAAC3C,IAAgB,MAAhBA,SAAA,OAAA,EAAAA,EAAkB8C,OAAOpB,EAAA7B,IAAA,MAAAA,kBAAAA,EAAQG,oBAAkB,MAAA0B,SAAA,OAAA,EAAAA,EAAAoB,QAEvDD,EAAAA,WAAU,KACR,MAAME,GACHH,IACArC,EACH,GAAIwC,EACFJ,GACD,GACA,CAACpC,EAAaqC,IAEjB,MAAO,CACLtB,eACAd,iBACAwC,cAAeJ,EACfK,gBAAiBrC,EACjBF,iBACAN,SACAG,cACD"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var t=require("../Icon/Icon.cjs.js");var r=require("../src/readyclasses.module.cjs.js");var a=require("./RemoveButton.module.cjs.js");function o(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var s=o(e);const l=({removeLabel:e="Remove",label:o,onRemove:l,...c},n)=>{var u;return l&&s["default"].createElement("button",{...c,ref:n,className:`${a["default"]["remove"]} ${(u=c.className)!==null&&u!==void 0?u:""}`,title:"",onClick:l},s["default"].createElement(t.Icon,{icon:t.Icons.Times,className:a["default"]["icon"]}),s["default"].createElement("span",{className:r["default"]["sr-only"]},e,o?" "+o:""))};const c=e.forwardRef(l);exports.RemoveButton=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});var e=require("react");var t=require("../Icon/Icon.cjs.js");var r=require("../src/readyclasses.module.cjs.js");var a=require("./RemoveButton.module.cjs.js");function o(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var s=o(e);const l=({removeLabel:e="Remove",label:o,onRemove:l,...c},n)=>{var u;return l&&s["default"].createElement("button",{title:"",type:"button",...c,ref:n,className:`${a["default"]["remove"]} ${(u=c.className)!==null&&u!==void 0?u:""}`,onClick:l},s["default"].createElement(t.Icon,{icon:t.Icons.Times,className:a["default"]["icon"]}),s["default"].createElement("span",{className:r["default"]["sr-only"]},e,o?" "+o:""))};const c=e.forwardRef(l);exports.RemoveButton=c;
2
2
  //# sourceMappingURL=RemoveButton.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemoveButton.cjs.js","sources":["../../../../../src/components/Tag/RemoveButton.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\n\nimport readyclasses from \"../../readyclasses.module.scss\";\nimport classes from \"./RemoveButton.module.scss\";\n\nexport interface Props extends HTMLAttributes<HTMLButtonElement> {\n removeLabel?: string;\n label?: string;\n onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst RemoveButtonComponent: ForwardRefRenderFunction<HTMLButtonElement, Props> = (\n { removeLabel = \"Remove\", label, onRemove, ...rest }: Props,\n ref\n) => {\n return (\n onRemove && (\n <button\n {...rest}\n ref={ref}\n className={`${classes[\"remove\"]} ${rest.className ?? \"\"}`}\n title=\"\"\n onClick={onRemove}\n >\n <Icon icon={Icons.Times} className={classes[\"icon\"]} />\n <span className={readyclasses[\"sr-only\"]}>\n {removeLabel}\n {label ? \" \" + label : \"\"}\n </span>\n </button>\n )\n );\n};\n\nexport const RemoveButton = forwardRef(RemoveButtonComponent);\n"],"names":["RemoveButtonComponent","removeLabel","label","onRemove","rest","ref","React","className","classes","_a","title","onClick","createElement","Icon","icon","Icons","Times","readyclasses","RemoveButton","forwardRef"],"mappings":"uTA4BA,MAAMA,EAA4E,EAC9EC,cAAc,SAAUC,QAAOC,cAAaC,GAC9CC,WAEA,OACEF,GACEG,wCACMF,EACJC,IAAKA,EACLE,UAAW,GAAGC,EAAO,WAAC,cAAaC,EAAAL,EAAKG,aAAa,MAAAE,SAAA,EAAAA,EAAA,KACrDC,MAAM,GACNC,QAASR,GAETG,EAAAA,WAAAM,cAACC,OAAI,CAACC,KAAMC,EAAAA,MAAMC,MAAOT,UAAWC,EAAAA,WAAQ,UAC5CF,EAAA,WAAAM,cAAA,OAAA,CAAML,UAAWU,EAAAA,WAAa,YAC3BhB,EACAC,EAAQ,IAAMA,EAAQ,IAI7B,QAGSgB,EAAeC,EAAUA,WAACnB"}
1
+ {"version":3,"file":"RemoveButton.cjs.js","sources":["../../../../../src/components/Tag/RemoveButton.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\n\nimport readyclasses from \"../../readyclasses.module.scss\";\nimport classes from \"./RemoveButton.module.scss\";\n\nexport interface Props extends HTMLAttributes<HTMLButtonElement> {\n removeLabel?: string;\n label?: string;\n onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst RemoveButtonComponent: ForwardRefRenderFunction<HTMLButtonElement, Props> = (\n { removeLabel = \"Remove\", label, onRemove, ...rest }: Props,\n ref\n) => {\n return (\n onRemove && (\n <button\n title=\"\"\n type=\"button\"\n {...rest}\n ref={ref}\n className={`${classes[\"remove\"]} ${rest.className ?? \"\"}`}\n onClick={onRemove}\n >\n <Icon icon={Icons.Times} className={classes[\"icon\"]} />\n <span className={readyclasses[\"sr-only\"]}>\n {removeLabel}\n {label ? \" \" + label : \"\"}\n </span>\n </button>\n )\n );\n};\n\nexport const RemoveButton = forwardRef(RemoveButtonComponent);\n"],"names":["RemoveButtonComponent","removeLabel","label","onRemove","rest","ref","React","createElement","title","type","className","classes","_a","onClick","Icon","icon","Icons","Times","readyclasses","RemoveButton","forwardRef"],"mappings":"uTA4BA,MAAMA,EAA4E,EAC9EC,cAAc,SAAUC,QAAOC,cAAaC,GAC9CC,WAEA,OACEF,GACEG,EAAA,WAAAC,cAAA,SAAA,CACEC,MAAM,GACNC,KAAK,YACDL,EACJC,IAAKA,EACLK,UAAW,GAAGC,EAAO,WAAC,cAAaC,EAAAR,EAAKM,aAAa,MAAAE,SAAA,EAAAA,EAAA,KACrDC,QAASV,GAETG,EAAAA,WAAAC,cAACO,OAAI,CAACC,KAAMC,EAAAA,MAAMC,MAAOP,UAAWC,EAAAA,WAAQ,UAC5CL,EAAA,WAAAC,cAAA,OAAA,CAAMG,UAAWQ,EAAAA,WAAa,YAC3BjB,EACAC,EAAQ,IAAMA,EAAQ,IAI7B,QAGSiB,EAAeC,EAAUA,WAACpB"}
@@ -1,2 +1,2 @@
1
- import e from"./useAddNewBtn.module.esm.js";import t,{useRef as n}from"react";const o=({addNew:o,filter:a})=>{var s;const d=n(null);const r=(s=o===null||o===void 0?void 0:o.label)!==null&&s!==void 0?s:"Create new";const l=()=>o&&t.createElement("button",{"data-testid":"select-action-button",className:e["action-button"],onClick:()=>o.onAddNew(a),ref:d,...o.btnProps},!a&&r,a&&t.createElement("span",{style:{fontWeight:"700"}},`"${a}"`),a&&` (${r.toLowerCase()})`);const i=o?e["has-sibling"]:"";return{addNewBtnOptionsContainerClassName:i,renderAddNew:l,addBtnRef:d}};export{o as useAddNewBtn};
1
+ import t from"./useAddNewBtn.module.esm.js";import e,{useRef as n}from"react";const o=({addNew:o,filter:a})=>{var s;const d=n(null);const r=(s=o===null||o===void 0?void 0:o.label)!==null&&s!==void 0?s:"Create new";const l=()=>o&&e.createElement("button",{"data-testid":"select-action-button",className:t["action-button"],onClick:()=>o.onAddNew(a),ref:d,type:"button",...o.btnProps},!a&&r,a&&e.createElement("span",{style:{fontWeight:"700"}},`"${a}"`),a&&` (${r.toLowerCase()})`);const i=o?t["has-sibling"]:"";return{addNewBtnOptionsContainerClassName:i,renderAddNew:l,addBtnRef:d}};export{o as useAddNewBtn};
2
2
  //# sourceMappingURL=useAddNewBtn.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAddNewBtn.esm.js","sources":["../../../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\n\ninterface Props {\n addNew?: AddNewProps;\n filter: string;\n}\n\nexport const useAddNewBtn = ({ addNew, filter }: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n\n const addNewLabel = addNew?.label ?? \"Create new\";\n\n const renderAddNew = () =>\n addNew && (\n <button\n data-testid={\"select-action-button\"}\n className={classes[\"action-button\"]}\n onClick={() => addNew.onAddNew(filter)}\n ref={addBtnRef}\n {...addNew.btnProps}\n >\n {!filter && addNewLabel}\n {filter && <span style={{ fontWeight: \"700\" }}>{`\"${filter}\"`}</span>}\n {filter && ` (${addNewLabel.toLowerCase()})`}\n </button>\n );\n\n const addNewBtnOptionsContainerClassName = addNew ? classes[\"has-sibling\"] : \"\";\n\n return {\n addNewBtnOptionsContainerClassName,\n renderAddNew,\n addBtnRef\n };\n};\n"],"names":["useAddNewBtn","addNew","filter","addBtnRef","useRef","addNewLabel","_a","label","renderAddNew","React","createElement","className","classes","onClick","onAddNew","ref","btnProps","style","fontWeight","toLowerCase","addNewBtnOptionsContainerClassName"],"mappings":"8EA0Ba,MAAAA,EAAe,EAAGC,SAAQC,mBACrC,MAAMC,EAAYC,EAA0B,MAE5C,MAAMC,GAAcC,EAAAL,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQM,SAAS,MAAAD,SAAA,EAAAA,EAAA,aAErC,MAAME,EAAe,IACnBP,GACEQ,EACeC,cAAA,SAAA,CAAA,cAAA,uBACbC,UAAWC,EAAQ,iBACnBC,QAAS,IAAMZ,EAAOa,SAASZ,GAC/Ba,IAAKZ,KACDF,EAAOe,WAETd,GAAUG,EACXH,GAAUO,EAAAC,cAAA,OAAA,CAAMO,MAAO,CAAEC,WAAY,QAAU,IAAIhB,MACnDA,GAAU,KAAKG,EAAYc,kBAIlC,MAAMC,EAAqCnB,EAASW,EAAQ,eAAiB,GAE7E,MAAO,CACLQ,qCACAZ,eACAL,YACD"}
1
+ {"version":3,"file":"useAddNewBtn.esm.js","sources":["../../../../../../src/components/Form/Select/useAddNewBtn.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classes from \"./useAddNewBtn.module.scss\";\n\nimport React, { useRef } from \"react\";\nimport { AddNewProps } from \"./Select.interfaces\";\n\ninterface Props {\n addNew?: AddNewProps;\n filter: string;\n}\n\nexport const useAddNewBtn = ({ addNew, filter }: Props) => {\n const addBtnRef = useRef<HTMLButtonElement>(null);\n\n const addNewLabel = addNew?.label ?? \"Create new\";\n\n const renderAddNew = () =>\n addNew && (\n <button\n data-testid={\"select-action-button\"}\n className={classes[\"action-button\"]}\n onClick={() => addNew.onAddNew(filter)}\n ref={addBtnRef}\n type=\"button\"\n {...addNew.btnProps}\n >\n {!filter && addNewLabel}\n {filter && <span style={{ fontWeight: \"700\" }}>{`\"${filter}\"`}</span>}\n {filter && ` (${addNewLabel.toLowerCase()})`}\n </button>\n );\n\n const addNewBtnOptionsContainerClassName = addNew ? classes[\"has-sibling\"] : \"\";\n\n return {\n addNewBtnOptionsContainerClassName,\n renderAddNew,\n addBtnRef\n };\n};\n"],"names":["useAddNewBtn","addNew","filter","addBtnRef","useRef","addNewLabel","_a","label","renderAddNew","React","createElement","className","classes","onClick","onAddNew","ref","type","btnProps","style","fontWeight","toLowerCase","addNewBtnOptionsContainerClassName"],"mappings":"8EA0Ba,MAAAA,EAAe,EAAGC,SAAQC,mBACrC,MAAMC,EAAYC,EAA0B,MAE5C,MAAMC,GAAcC,EAAAL,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQM,SAAS,MAAAD,SAAA,EAAAA,EAAA,aAErC,MAAME,EAAe,IACnBP,GACEQ,EAAAC,cAAA,SAAA,CAAA,cACe,uBACbC,UAAWC,EAAQ,iBACnBC,QAAS,IAAMZ,EAAOa,SAASZ,GAC/Ba,IAAKZ,EACLa,KAAK,YACDf,EAAOgB,WAETf,GAAUG,EACXH,GAAUO,EAAAC,cAAA,OAAA,CAAMQ,MAAO,CAAEC,WAAY,QAAU,IAAIjB,MACnDA,GAAU,KAAKG,EAAYe,kBAIlC,MAAMC,EAAqCpB,EAASW,EAAQ,eAAiB,GAE7E,MAAO,CACLS,qCACAb,eACAL,YACD"}
@@ -1,2 +1,2 @@
1
- import e,{useState as o,useRef as r,useEffect as l}from"react";import{Input as n}from"../Input/Input.esm.js";const s=({search:s,optionsCount:t,searchPlaceholder:i,searchInputProps:a,searchInputClassName:d,expanded:c,setFocusedSelectItem:u})=>{var v,p;const[h,m]=o("");const[f,I]=o(false);const P=10;const N=r(null);const b=(v=s===null||s===void 0?void 0:s.renderThreshold)!==null&&v!==void 0?v:P;const g=t>b;const S=e=>{m(e.currentTarget.value)};const w=()=>{if(s===null||s===void 0?void 0:s.enabled)return g;if(s)return s.enabled;return t>P};const x=()=>{var o,r,l,t,u,v,p;return e.createElement(n,{...(r=(o=s===null||s===void 0?void 0:s.searchInputProps)!==null&&o!==void 0?o:a)!==null&&r!==void 0?r:{},ref:N,onFocus:()=>I(true),onBlur:()=>I(false),onChange:S,className:d,wrapperProps:{className:(u=(t=(l=s===null||s===void 0?void 0:s.searchInputProps)===null||l===void 0?void 0:l.wrapperProps)===null||t===void 0?void 0:t.className)!==null&&u!==void 0?u:(v=a===null||a===void 0?void 0:a.wrapperProps)===null||v===void 0?void 0:v.className},style:{display:c?"block":"none"},type:"text",name:"search-option",placeholder:(p=s===null||s===void 0?void 0:s.searchPlaceholder)!==null&&p!==void 0?p:i})};const y=()=>{m("");I(false);u(-1)};const C=w();l((()=>{var e;(((e=s===null||s===void 0?void 0:s.searchInputProps)===null||e===void 0?void 0:e.reset)||(a===null||a===void 0?void 0:a.reset))&&y()}),[a===null||a===void 0?void 0:a.reset,(p=s===null||s===void 0?void 0:s.searchInputProps)===null||p===void 0?void 0:p.reset]);l((()=>{const e=!C&&!f;if(e)y()}),[f,C]);return{renderSearch:x,setIsSearching:I,searchVisible:C,searchThreshold:b,searchInputRef:N,filter:h,isSearching:f}};export{s as useSearch};
1
+ import e,{useState as o,useRef as r,useEffect as l}from"react";import{Input as n}from"../Input/Input.esm.js";const s=({search:s,optionsCount:t,searchPlaceholder:i,searchInputProps:a,searchInputClassName:d,expanded:c,setFocusedSelectItem:u})=>{var v,p;const[h,m]=o("");const[f,I]=o(false);const P=10;const N=r(null);const b=(v=s===null||s===void 0?void 0:s.renderThreshold)!==null&&v!==void 0?v:P;const g=t>=b;const S=e=>{m(e.currentTarget.value)};const w=()=>{if(s===null||s===void 0?void 0:s.enabled)return g;if(s)return s.enabled;return t>P};const x=()=>{var o,r,l,t,u,v,p;return e.createElement(n,{...(r=(o=s===null||s===void 0?void 0:s.searchInputProps)!==null&&o!==void 0?o:a)!==null&&r!==void 0?r:{},ref:N,onFocus:()=>I(true),onBlur:()=>I(false),onChange:S,className:d,wrapperProps:{className:(u=(t=(l=s===null||s===void 0?void 0:s.searchInputProps)===null||l===void 0?void 0:l.wrapperProps)===null||t===void 0?void 0:t.className)!==null&&u!==void 0?u:(v=a===null||a===void 0?void 0:a.wrapperProps)===null||v===void 0?void 0:v.className},style:{display:c?"block":"none"},type:"text",name:"search-option",placeholder:(p=s===null||s===void 0?void 0:s.searchPlaceholder)!==null&&p!==void 0?p:i})};const y=()=>{m("");I(false);u(-1)};const C=w();l((()=>{var e;(((e=s===null||s===void 0?void 0:s.searchInputProps)===null||e===void 0?void 0:e.reset)||(a===null||a===void 0?void 0:a.reset))&&y()}),[a===null||a===void 0?void 0:a.reset,(p=s===null||s===void 0?void 0:s.searchInputProps)===null||p===void 0?void 0:p.reset]);l((()=>{const e=!C&&!f;if(e)y()}),[f,C]);return{renderSearch:x,setIsSearching:I,searchVisible:C,searchThreshold:b,searchInputRef:N,filter:h,isSearching:f}};export{s as useSearch};
2
2
  //# sourceMappingURL=useSearch.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSearch.esm.js","sources":["../../../../../../src/components/Form/Select/useSearch.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { PartialInputProps, SearchProps } from \"./Select.interfaces\";\nimport { Input } from \"../Input/Input\";\n\ninterface Props {\n search?: SearchProps;\n optionsCount: number;\n /**\n * @deprecated\n */\n searchPlaceholder?: string;\n /**\n * @deprecated\n */\n searchInputProps?: PartialInputProps & { reset?: boolean };\n searchInputClassName: string;\n expanded: boolean;\n setFocusedSelectItem: (idx: number) => void;\n}\n\nexport const useSearch = ({\n search,\n optionsCount,\n searchPlaceholder,\n searchInputProps,\n searchInputClassName,\n expanded,\n setFocusedSelectItem\n}: Props) => {\n const [filter, setFilter] = useState(\"\");\n const [isSearching, setIsSearching] = useState(false);\n\n const DEFAULT_RENDER_THRESHOLD = 10;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n const threshold = search?.renderThreshold ?? DEFAULT_RENDER_THRESHOLD;\n const hasEnoughChildren = optionsCount > threshold;\n\n const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {\n setFilter(event.currentTarget.value);\n };\n\n const shouldRenderSearch = () => {\n if (search?.enabled) {\n return hasEnoughChildren;\n }\n\n if (search) {\n return search.enabled as boolean;\n }\n\n return optionsCount > DEFAULT_RENDER_THRESHOLD;\n };\n\n const renderSearch = () => (\n <Input\n {...(search?.searchInputProps ?? searchInputProps ?? {})}\n ref={searchInputRef}\n onFocus={() => setIsSearching(true)}\n onBlur={() => setIsSearching(false)}\n onChange={filterResults}\n className={searchInputClassName}\n wrapperProps={{\n className:\n search?.searchInputProps?.wrapperProps?.className ??\n searchInputProps?.wrapperProps?.className\n }}\n style={{\n display: expanded ? \"block\" : \"none\"\n }}\n type=\"text\"\n name=\"search-option\"\n placeholder={search?.searchPlaceholder ?? searchPlaceholder}\n />\n );\n\n const resetSearchState = () => {\n setFilter(\"\");\n setIsSearching(false);\n setFocusedSelectItem(-1);\n };\n\n const visible = shouldRenderSearch();\n\n useEffect(() => {\n (search?.searchInputProps?.reset || searchInputProps?.reset) && resetSearchState();\n }, [searchInputProps?.reset, search?.searchInputProps?.reset]);\n\n useEffect(() => {\n const searchDeactivated =\n !visible &&\n !isSearching; /*solves issue in MultiSelect when we filtered result and selected result causes list to be shorter than threshold so still we have a filter applied but can't change it due to `visible` variable has false */\n if (searchDeactivated) {\n resetSearchState();\n }\n }, [isSearching, visible]);\n\n return {\n renderSearch,\n setIsSearching,\n searchVisible: visible,\n searchThreshold: threshold,\n searchInputRef,\n filter,\n isSearching\n };\n};\n"],"names":["useSearch","search","optionsCount","searchPlaceholder","searchInputProps","searchInputClassName","expanded","setFocusedSelectItem","filter","setFilter","useState","isSearching","setIsSearching","DEFAULT_RENDER_THRESHOLD","searchInputRef","useRef","threshold","_a","renderThreshold","hasEnoughChildren","filterResults","event","currentTarget","value","shouldRenderSearch","enabled","renderSearch","React","createElement","Input","_b","ref","onFocus","onBlur","onChange","className","wrapperProps","_e","_d","_c","_f","style","display","type","name","placeholder","_g","resetSearchState","visible","useEffect","reset","searchDeactivated","searchVisible","searchThreshold"],"mappings":"mHAoCaA,EAAY,EACvBC,SACAC,eACAC,oBACAC,mBACAC,uBACAC,WACAC,mCAEA,MAAOC,EAAQC,GAAaC,EAAS,IACrC,MAAOC,EAAaC,GAAkBF,EAAS,OAE/C,MAAMG,EAA2B,GAEjC,MAAMC,EAAiBC,EAAyB,MAEhD,MAAMC,GAAYC,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQiB,mBAAmB,MAAAD,SAAA,EAAAA,EAAAJ,EAC7C,MAAMM,EAAoBjB,EAAec,EAEzC,MAAMI,EAAiBC,IACrBZ,EAAUY,EAAMC,cAAcC,MAAM,EAGtC,MAAMC,EAAqB,KACzB,GAAIvB,UAAAA,SAAM,OAAA,EAANA,EAAQwB,QACV,OAAON,EAGT,GAAIlB,EACF,OAAOA,EAAOwB,QAGhB,OAAOvB,EAAeW,CAAwB,EAGhD,MAAMa,EAAe,uBAAM,OACzBC,EAACC,cAAAC,EACK,QAACZ,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQG,oBAAgB,MAAAa,SAAA,EAAAA,EAAIb,KAAgB,MAAA0B,SAAA,EAAAA,EAAI,CAAA,EACrDC,IAAKjB,EACLkB,QAAS,IAAMpB,EAAe,MAC9BqB,OAAQ,IAAMrB,EAAe,OAC7BsB,SAAUd,EACVe,UAAW9B,EACX+B,aAAc,CACZD,WACEE,GAAAC,GAAAC,EAAAtC,UAAAA,SAAM,OAAA,EAANA,EAAQG,oBAAgB,MAAAmC,SAAA,OAAA,EAAAA,EAAEH,gBAAc,MAAAE,SAAA,OAAA,EAAAA,EAAAH,aACxC,MAAAE,SAAA,EAAAA,GAAAG,EAAApC,IAAgB,MAAhBA,SAAgB,OAAA,EAAhBA,EAAkBgC,gBAAY,MAAAI,SAAA,OAAA,EAAAA,EAAEL,WAEpCM,MAAO,CACLC,QAASpC,EAAW,QAAU,QAEhCqC,KAAK,OACLC,KAAK,gBACLC,aAAaC,EAAA7C,IAAA,MAAAA,kBAAAA,EAAQE,qBAAqB,MAAA2C,SAAA,EAAAA,EAAA3C,GAE7C,EAED,MAAM4C,EAAmB,KACvBtC,EAAU,IACVG,EAAe,OACfL,GAAsB,EAAE,EAG1B,MAAMyC,EAAUxB,IAEhByB,GAAU,cACPhC,EAAAhB,IAAA,MAAAA,kBAAAA,EAAQG,oBAAgB,MAAAa,SAAA,OAAA,EAAAA,EAAEiC,SAAS9C,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAkB8C,SAAUH,GAAkB,GACjF,CAAC3C,IAAgB,MAAhBA,SAAA,OAAA,EAAAA,EAAkB8C,OAAOpB,EAAA7B,IAAA,MAAAA,kBAAAA,EAAQG,oBAAkB,MAAA0B,SAAA,OAAA,EAAAA,EAAAoB,QAEvDD,GAAU,KACR,MAAME,GACHH,IACArC,EACH,GAAIwC,EACFJ,GACD,GACA,CAACpC,EAAaqC,IAEjB,MAAO,CACLtB,eACAd,iBACAwC,cAAeJ,EACfK,gBAAiBrC,EACjBF,iBACAN,SACAG,cACD"}
1
+ {"version":3,"file":"useSearch.esm.js","sources":["../../../../../../src/components/Form/Select/useSearch.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { PartialInputProps, SearchProps } from \"./Select.interfaces\";\nimport { Input } from \"../Input/Input\";\n\ninterface Props {\n search?: SearchProps;\n optionsCount: number;\n /**\n * @deprecated\n */\n searchPlaceholder?: string;\n /**\n * @deprecated\n */\n searchInputProps?: PartialInputProps & { reset?: boolean };\n searchInputClassName: string;\n expanded: boolean;\n setFocusedSelectItem: (idx: number) => void;\n}\n\nexport const useSearch = ({\n search,\n optionsCount,\n searchPlaceholder,\n searchInputProps,\n searchInputClassName,\n expanded,\n setFocusedSelectItem\n}: Props) => {\n const [filter, setFilter] = useState(\"\");\n const [isSearching, setIsSearching] = useState(false);\n\n const DEFAULT_RENDER_THRESHOLD = 10;\n\n const searchInputRef = useRef<HTMLInputElement>(null);\n\n const threshold = search?.renderThreshold ?? DEFAULT_RENDER_THRESHOLD;\n const hasEnoughChildren = optionsCount >= threshold;\n\n const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {\n setFilter(event.currentTarget.value);\n };\n\n const shouldRenderSearch = () => {\n if (search?.enabled) {\n return hasEnoughChildren;\n }\n\n if (search) {\n return search.enabled as boolean;\n }\n\n return optionsCount > DEFAULT_RENDER_THRESHOLD;\n };\n\n const renderSearch = () => (\n <Input\n {...(search?.searchInputProps ?? searchInputProps ?? {})}\n ref={searchInputRef}\n onFocus={() => setIsSearching(true)}\n onBlur={() => setIsSearching(false)}\n onChange={filterResults}\n className={searchInputClassName}\n wrapperProps={{\n className:\n search?.searchInputProps?.wrapperProps?.className ??\n searchInputProps?.wrapperProps?.className\n }}\n style={{\n display: expanded ? \"block\" : \"none\"\n }}\n type=\"text\"\n name=\"search-option\"\n placeholder={search?.searchPlaceholder ?? searchPlaceholder}\n />\n );\n\n const resetSearchState = () => {\n setFilter(\"\");\n setIsSearching(false);\n setFocusedSelectItem(-1);\n };\n\n const visible = shouldRenderSearch();\n\n useEffect(() => {\n (search?.searchInputProps?.reset || searchInputProps?.reset) && resetSearchState();\n }, [searchInputProps?.reset, search?.searchInputProps?.reset]);\n\n useEffect(() => {\n const searchDeactivated =\n !visible &&\n !isSearching; /*solves issue in MultiSelect when we filtered result and selected result causes list to be shorter than threshold so still we have a filter applied but can't change it due to `visible` variable has false */\n if (searchDeactivated) {\n resetSearchState();\n }\n }, [isSearching, visible]);\n\n return {\n renderSearch,\n setIsSearching,\n searchVisible: visible,\n searchThreshold: threshold,\n searchInputRef,\n filter,\n isSearching\n };\n};\n"],"names":["useSearch","search","optionsCount","searchPlaceholder","searchInputProps","searchInputClassName","expanded","setFocusedSelectItem","filter","setFilter","useState","isSearching","setIsSearching","DEFAULT_RENDER_THRESHOLD","searchInputRef","useRef","threshold","_a","renderThreshold","hasEnoughChildren","filterResults","event","currentTarget","value","shouldRenderSearch","enabled","renderSearch","React","createElement","Input","_b","ref","onFocus","onBlur","onChange","className","wrapperProps","_e","_d","_c","_f","style","display","type","name","placeholder","_g","resetSearchState","visible","useEffect","reset","searchDeactivated","searchVisible","searchThreshold"],"mappings":"mHAoCaA,EAAY,EACvBC,SACAC,eACAC,oBACAC,mBACAC,uBACAC,WACAC,mCAEA,MAAOC,EAAQC,GAAaC,EAAS,IACrC,MAAOC,EAAaC,GAAkBF,EAAS,OAE/C,MAAMG,EAA2B,GAEjC,MAAMC,EAAiBC,EAAyB,MAEhD,MAAMC,GAAYC,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQiB,mBAAmB,MAAAD,SAAA,EAAAA,EAAAJ,EAC7C,MAAMM,EAAoBjB,GAAgBc,EAE1C,MAAMI,EAAiBC,IACrBZ,EAAUY,EAAMC,cAAcC,MAAM,EAGtC,MAAMC,EAAqB,KACzB,GAAIvB,UAAAA,SAAM,OAAA,EAANA,EAAQwB,QACV,OAAON,EAGT,GAAIlB,EACF,OAAOA,EAAOwB,QAGhB,OAAOvB,EAAeW,CAAwB,EAGhD,MAAMa,EAAe,uBAAM,OACzBC,EAACC,cAAAC,EACK,QAACZ,EAAAhB,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAQG,oBAAgB,MAAAa,SAAA,EAAAA,EAAIb,KAAgB,MAAA0B,SAAA,EAAAA,EAAI,CAAA,EACrDC,IAAKjB,EACLkB,QAAS,IAAMpB,EAAe,MAC9BqB,OAAQ,IAAMrB,EAAe,OAC7BsB,SAAUd,EACVe,UAAW9B,EACX+B,aAAc,CACZD,WACEE,GAAAC,GAAAC,EAAAtC,UAAAA,SAAM,OAAA,EAANA,EAAQG,oBAAgB,MAAAmC,SAAA,OAAA,EAAAA,EAAEH,gBAAc,MAAAE,SAAA,OAAA,EAAAA,EAAAH,aACxC,MAAAE,SAAA,EAAAA,GAAAG,EAAApC,IAAgB,MAAhBA,SAAgB,OAAA,EAAhBA,EAAkBgC,gBAAY,MAAAI,SAAA,OAAA,EAAAA,EAAEL,WAEpCM,MAAO,CACLC,QAASpC,EAAW,QAAU,QAEhCqC,KAAK,OACLC,KAAK,gBACLC,aAAaC,EAAA7C,IAAA,MAAAA,kBAAAA,EAAQE,qBAAqB,MAAA2C,SAAA,EAAAA,EAAA3C,GAE7C,EAED,MAAM4C,EAAmB,KACvBtC,EAAU,IACVG,EAAe,OACfL,GAAsB,EAAE,EAG1B,MAAMyC,EAAUxB,IAEhByB,GAAU,cACPhC,EAAAhB,IAAA,MAAAA,kBAAAA,EAAQG,oBAAgB,MAAAa,SAAA,OAAA,EAAAA,EAAEiC,SAAS9C,IAAA,MAAAA,SAAA,OAAA,EAAAA,EAAkB8C,SAAUH,GAAkB,GACjF,CAAC3C,IAAgB,MAAhBA,SAAA,OAAA,EAAAA,EAAkB8C,OAAOpB,EAAA7B,IAAA,MAAAA,kBAAAA,EAAQG,oBAAkB,MAAA0B,SAAA,OAAA,EAAAA,EAAAoB,QAEvDD,GAAU,KACR,MAAME,GACHH,IACArC,EACH,GAAIwC,EACFJ,GACD,GACA,CAACpC,EAAaqC,IAEjB,MAAO,CACLtB,eACAd,iBACAwC,cAAeJ,EACfK,gBAAiBrC,EACjBF,iBACAN,SACAG,cACD"}
@@ -1,2 +1,2 @@
1
- import e,{forwardRef as o}from"react";import{Icon as m,Icons as s}from"../Icon/Icon.esm.js";import r from"../src/readyclasses.module.esm.js";import t from"./RemoveButton.module.esm.js";const a=({removeLabel:o="Remove",label:a,onRemove:l,...c},n)=>{var i;return l&&e.createElement("button",{...c,ref:n,className:`${t["remove"]} ${(i=c.className)!==null&&i!==void 0?i:""}`,title:"",onClick:l},e.createElement(m,{icon:s.Times,className:t["icon"]}),e.createElement("span",{className:r["sr-only"]},o,a?" "+a:""))};const l=o(a);export{l as RemoveButton};
1
+ import e,{forwardRef as o}from"react";import{Icon as m,Icons as t}from"../Icon/Icon.esm.js";import s from"../src/readyclasses.module.esm.js";import r from"./RemoveButton.module.esm.js";const a=({removeLabel:o="Remove",label:a,onRemove:l,...n},c)=>{var i;return l&&e.createElement("button",{title:"",type:"button",...n,ref:c,className:`${r["remove"]} ${(i=n.className)!==null&&i!==void 0?i:""}`,onClick:l},e.createElement(m,{icon:t.Times,className:r["icon"]}),e.createElement("span",{className:s["sr-only"]},o,a?" "+a:""))};const l=o(a);export{l as RemoveButton};
2
2
  //# sourceMappingURL=RemoveButton.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemoveButton.esm.js","sources":["../../../../../src/components/Tag/RemoveButton.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\n\nimport readyclasses from \"../../readyclasses.module.scss\";\nimport classes from \"./RemoveButton.module.scss\";\n\nexport interface Props extends HTMLAttributes<HTMLButtonElement> {\n removeLabel?: string;\n label?: string;\n onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst RemoveButtonComponent: ForwardRefRenderFunction<HTMLButtonElement, Props> = (\n { removeLabel = \"Remove\", label, onRemove, ...rest }: Props,\n ref\n) => {\n return (\n onRemove && (\n <button\n {...rest}\n ref={ref}\n className={`${classes[\"remove\"]} ${rest.className ?? \"\"}`}\n title=\"\"\n onClick={onRemove}\n >\n <Icon icon={Icons.Times} className={classes[\"icon\"]} />\n <span className={readyclasses[\"sr-only\"]}>\n {removeLabel}\n {label ? \" \" + label : \"\"}\n </span>\n </button>\n )\n );\n};\n\nexport const RemoveButton = forwardRef(RemoveButtonComponent);\n"],"names":["RemoveButtonComponent","removeLabel","label","onRemove","rest","ref","React","className","classes","_a","title","onClick","createElement","Icon","icon","Icons","Times","readyclasses","RemoveButton","forwardRef"],"mappings":"yLA4BA,MAAMA,EAA4E,EAC9EC,cAAc,SAAUC,QAAOC,cAAaC,GAC9CC,WAEA,OACEF,GACEG,6BACMF,EACJC,IAAKA,EACLE,UAAW,GAAGC,EAAQ,cAAaC,EAAAL,EAAKG,aAAa,MAAAE,SAAA,EAAAA,EAAA,KACrDC,MAAM,GACNC,QAASR,GAETG,EAAAM,cAACC,EAAI,CAACC,KAAMC,EAAMC,MAAOT,UAAWC,EAAQ,UAC5CF,EAAAM,cAAA,OAAA,CAAML,UAAWU,EAAa,YAC3BhB,EACAC,EAAQ,IAAMA,EAAQ,IAI7B,QAGSgB,EAAeC,EAAWnB"}
1
+ {"version":3,"file":"RemoveButton.esm.js","sources":["../../../../../src/components/Tag/RemoveButton.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ForwardRefRenderFunction, HTMLAttributes, forwardRef } from \"react\";\nimport { Icon, Icons } from \"../Icon/Icon\";\n\nimport readyclasses from \"../../readyclasses.module.scss\";\nimport classes from \"./RemoveButton.module.scss\";\n\nexport interface Props extends HTMLAttributes<HTMLButtonElement> {\n removeLabel?: string;\n label?: string;\n onRemove?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst RemoveButtonComponent: ForwardRefRenderFunction<HTMLButtonElement, Props> = (\n { removeLabel = \"Remove\", label, onRemove, ...rest }: Props,\n ref\n) => {\n return (\n onRemove && (\n <button\n title=\"\"\n type=\"button\"\n {...rest}\n ref={ref}\n className={`${classes[\"remove\"]} ${rest.className ?? \"\"}`}\n onClick={onRemove}\n >\n <Icon icon={Icons.Times} className={classes[\"icon\"]} />\n <span className={readyclasses[\"sr-only\"]}>\n {removeLabel}\n {label ? \" \" + label : \"\"}\n </span>\n </button>\n )\n );\n};\n\nexport const RemoveButton = forwardRef(RemoveButtonComponent);\n"],"names":["RemoveButtonComponent","removeLabel","label","onRemove","rest","ref","React","createElement","title","type","className","classes","_a","onClick","Icon","icon","Icons","Times","readyclasses","RemoveButton","forwardRef"],"mappings":"yLA4BA,MAAMA,EAA4E,EAC9EC,cAAc,SAAUC,QAAOC,cAAaC,GAC9CC,WAEA,OACEF,GACEG,EAAAC,cAAA,SAAA,CACEC,MAAM,GACNC,KAAK,YACDL,EACJC,IAAKA,EACLK,UAAW,GAAGC,EAAQ,cAAaC,EAAAR,EAAKM,aAAa,MAAAE,SAAA,EAAAA,EAAA,KACrDC,QAASV,GAETG,EAAAC,cAACO,EAAI,CAACC,KAAMC,EAAMC,MAAOP,UAAWC,EAAQ,UAC5CL,EAAAC,cAAA,OAAA,CAAMG,UAAWQ,EAAa,YAC3BjB,EACAC,EAAQ,IAAMA,EAAQ,IAI7B,QAGSiB,EAAeC,EAAWpB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "homepage": "http://onewelcome.github.io/react-lib-components",
3
3
  "name": "@onewelcome/react-lib-components",
4
- "version": "6.4.1",
4
+ "version": "6.4.3",
5
5
  "license": "Apache-2.0",
6
6
  "author": "OneWelcome B.V.",
7
7
  "main": "dist/cjs/src/index.cjs.js",
@@ -52,13 +52,13 @@
52
52
  "node": ">=16"
53
53
  },
54
54
  "devDependencies": {
55
- "@babel/core": "^7.23.9",
56
- "@babel/preset-env": "^7.23.9",
55
+ "@babel/core": "^7.24.0",
56
+ "@babel/preset-env": "^7.24.0",
57
57
  "@babel/preset-react": "^7.23.3",
58
58
  "@babel/preset-typescript": "^7.23.3",
59
- "@mdx-js/react": "^3.0.0",
59
+ "@mdx-js/react": "^3.0.1",
60
60
  "@onewelcome/eslint-config-shared-codestyle": "^9.1.0",
61
- "@onewelcome/storybook-addon-basestyling": "^1.0.1",
61
+ "@onewelcome/storybook-addon-basestyling": "^1.0.2",
62
62
  "@rollup/plugin-commonjs": "^25.0.7",
63
63
  "@rollup/plugin-node-resolve": "^15.2.3",
64
64
  "@rollup/plugin-typescript": "^11.1.6",
@@ -82,8 +82,8 @@
82
82
  "@testing-library/user-event": "^14.5.2",
83
83
  "@types/jest": "^29.5.12",
84
84
  "@types/mdx": "^2.0.11",
85
- "@types/react": "^18.2.55",
86
- "@types/react-dom": "^18.2.19",
85
+ "@types/react": "^18.2.65",
86
+ "@types/react-dom": "^18.2.21",
87
87
  "@types/react-router": "^5.1.20",
88
88
  "@types/react-router-dom": "^5.3.3",
89
89
  "@typescript-eslint/eslint-plugin": "^6.21.0",
@@ -91,24 +91,24 @@
91
91
  "babel-loader": "^9.1.3",
92
92
  "chromatic": "^10.9.3",
93
93
  "css-loader": "^6.10.0",
94
- "eslint": "^8.56.0",
94
+ "eslint": "^8.57.0",
95
95
  "eslint-config-prettier": "^9.1.0",
96
96
  "eslint-plugin-cypress": "^2.15.1",
97
97
  "eslint-plugin-export-scope": "^2.0.5",
98
- "eslint-plugin-jest": "^27.6.3",
98
+ "eslint-plugin-jest": "^27.9.0",
99
99
  "eslint-plugin-license-header": "^0.6.0",
100
100
  "eslint-plugin-prettier": "^5.1.3",
101
- "eslint-plugin-react": "^7.33.2",
101
+ "eslint-plugin-react": "^7.34.0",
102
102
  "eslint-plugin-react-hooks": "^4.6.0",
103
103
  "eslint-plugin-storybook": "^0.6.15",
104
- "husky": "^9.0.10",
104
+ "husky": "^9.0.11",
105
105
  "identity-obj-proxy": "^3.0.0",
106
106
  "jest": "^29.7.0",
107
107
  "jest-environment-jsdom": "^29.7.0",
108
108
  "jest-junit": "^16.0.0",
109
109
  "jest-sonar-reporter": "^2.0.0",
110
110
  "lint-staged": "^15.2.2",
111
- "mini-css-extract-plugin": "^2.8.0",
111
+ "mini-css-extract-plugin": "^2.8.1",
112
112
  "npm-run-all": "^4.1.5",
113
113
  "postcss": "^8.4.35",
114
114
  "postcss-modules": "^6.0.0",
@@ -117,16 +117,16 @@
117
117
  "react": "^18.2.0",
118
118
  "react-dom": "^18.2.0",
119
119
  "react-is": "^18.2.0",
120
- "react-router-dom": "^6.22.0",
120
+ "react-router-dom": "^6.22.3",
121
121
  "remark-gfm": "^4.0.0",
122
122
  "rollup": "^2.79.1",
123
123
  "rollup-plugin-postcss": "^4.0.2",
124
124
  "rollup-plugin-terser": "^7.0.2",
125
- "sass": "^1.70.0",
126
- "sass-loader": "^14.1.0",
127
- "size-limit": "^11.0.2",
125
+ "sass": "^1.71.1",
126
+ "sass-loader": "^14.1.1",
127
+ "size-limit": "^11.0.3",
128
128
  "storybook": "^7.6.14",
129
- "storybook-addon-pseudo-states": "^2.1.2",
129
+ "storybook-addon-pseudo-states": "^2.2.1",
130
130
  "style-loader": "^3.3.4",
131
131
  "ts-jest": "^29.1.2",
132
132
  "tslib": "^2.6.2",
@@ -36,6 +36,7 @@ export const useAddNewBtn = ({ addNew, filter }: Props) => {
36
36
  className={classes["action-button"]}
37
37
  onClick={() => addNew.onAddNew(filter)}
38
38
  ref={addBtnRef}
39
+ type="button"
39
40
  {...addNew.btnProps}
40
41
  >
41
42
  {!filter && addNewLabel}
@@ -51,7 +51,7 @@ export const useSearch = ({
51
51
  const searchInputRef = useRef<HTMLInputElement>(null);
52
52
 
53
53
  const threshold = search?.renderThreshold ?? DEFAULT_RENDER_THRESHOLD;
54
- const hasEnoughChildren = optionsCount > threshold;
54
+ const hasEnoughChildren = optionsCount >= threshold;
55
55
 
56
56
  const filterResults = (event: React.ChangeEvent<HTMLInputElement>) => {
57
57
  setFilter(event.currentTarget.value);
@@ -33,10 +33,11 @@ const RemoveButtonComponent: ForwardRefRenderFunction<HTMLButtonElement, Props>
33
33
  return (
34
34
  onRemove && (
35
35
  <button
36
+ title=""
37
+ type="button"
36
38
  {...rest}
37
39
  ref={ref}
38
40
  className={`${classes["remove"]} ${rest.className ?? ""}`}
39
- title=""
40
41
  onClick={onRemove}
41
42
  >
42
43
  <Icon icon={Icons.Times} className={classes["icon"]} />