@foodpilot/foods 2.23.0 → 2.24.0

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.
@@ -18,6 +18,7 @@ export type ExtraSelectOptions = {
18
18
  closeOnSelect?: boolean;
19
19
  disableSearch?: boolean;
20
20
  disableOnEmpty?: boolean;
21
+ filterControls?: ReactNode;
21
22
  };
22
23
  type FoodsSelectContextInitialValues = ExtraSelectOptions & SearchOptions & {
23
24
  disabled: boolean;
@@ -1,6 +1,6 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Box as o,Typography as i,IconButton as n}from"@mui/material";import r from"../../../assets/undo.svg.js";import{Select as s}from"./Select.js";import{FoodsSelectContextProvider as a}from"./Context/Provider.js";import{useFoodsSelectContext as l}from"./Context/useSelect.js";import{useState as c}from"react";const d=a=>{const{options:c,id:d,selectedOption:p,originalValue:m,onChange:h,getId:u,getName:x,getIcon:O,getGroupName:S,unit:g,BoxProps:b={},BoxOptionsProps:f={},infiniteScroll:C}=a,{disabled:y,textOptions:V}=l(),j=((e,t)=>!0!==e&&0!==t.length)(y,c);/* @__PURE__ */
2
- return t(o,{sx:{width:"300px",...b},children:[
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Box as o,Typography as i,IconButton as n}from"@mui/material";import r from"../../../assets/undo.svg.js";import{Select as s}from"./Select.js";import{FoodsSelectContextProvider as l}from"./Context/Provider.js";import{useFoodsSelectContext as a}from"./Context/useSelect.js";import{useState as c}from"react";const d=l=>{const{options:c,id:d,selectedOption:p,originalValue:m,onChange:h,getId:u,getName:x,getIcon:O,getGroupName:S,unit:f,BoxProps:g={},BoxOptionsProps:b={},infiniteScroll:C}=l,{disabled:y,textOptions:V}=a(),j=((e,t)=>!0!==e&&0!==t.length)(y,c);/* @__PURE__ */
2
+ return t(o,{sx:{width:"300px",...g},children:[
3
3
  /* @__PURE__ */t(o,{sx:{display:"flex",alignItems:"center",direction:"row",gap:"8px"},children:[
4
- /* @__PURE__ */e(s,{id:d,options:c,getId:u,getName:x,onChange:h,getIcon:O,getGroupName:S,selectedOption:p,BoxOptionsProps:f,infiniteScroll:C}),g&&/* @__PURE__ */e(i,{variant:"body",children:g}),j&&m&&/* @__PURE__ */e(n,{onClick:()=>h(m),children:/* @__PURE__ */e(r,{})})]}),j&&m&&/* @__PURE__ */e(i,{variant:"small-medium",children:`${V.defaultValueText} : ${x(m)}`})]})},p=t=>{const{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,disableSearch:s,disableOnEmpty:l=!1,...p}=t,[m,h]=c("");/* @__PURE__ */
5
- return e(a,{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,disableSearch:s,search:m,setSearch:h,isSearchFound:e=>""===m||e.toLowerCase().includes(m.toLowerCase()),disableOnEmpty:l,children:/* @__PURE__ */e(d,{...p})})},m=t=>{const{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,search:s,setSearch:l,isSearchFound:c,disableOnEmpty:p=!1,...m}=t;/* @__PURE__ */
6
- return e(a,{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,search:s,setSearch:l,isSearchFound:c,disableOnEmpty:p,children:/* @__PURE__ */e(d,{...m})})};export{p as FoodsSelect,m as FoodsSelectServerPagination};
4
+ /* @__PURE__ */e(s,{id:d,options:c,getId:u,getName:x,onChange:h,getIcon:O,getGroupName:S,selectedOption:p,BoxOptionsProps:b,infiniteScroll:C}),f&&/* @__PURE__ */e(i,{variant:"body",children:f}),j&&m&&/* @__PURE__ */e(n,{onClick:()=>h(m),children:/* @__PURE__ */e(r,{})})]}),j&&m&&/* @__PURE__ */e(i,{variant:"small-medium",children:`${V.defaultValueText} : ${x(m)}`})]})},p=t=>{const{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,disableSearch:s,disableOnEmpty:a=!1,filterControls:p,...m}=t,[h,u]=c("");/* @__PURE__ */
5
+ return e(l,{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,disableSearch:s,search:h,setSearch:u,isSearchFound:e=>""===h||e.toLowerCase().includes(h.toLowerCase()),disableOnEmpty:a,filterControls:p,children:/* @__PURE__ */e(d,{...m})})},m=t=>{const{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,search:s,setSearch:a,isSearchFound:c,disableOnEmpty:p=!1,filterControls:m,...h}=t;/* @__PURE__ */
6
+ return e(l,{textOptions:o,noValue:i,disabled:n,closeOnSelect:r,search:s,setSearch:a,isSearchFound:c,disableOnEmpty:p,filterControls:m,children:/* @__PURE__ */e(d,{...h})})};export{p as FoodsSelect,m as FoodsSelectServerPagination};
@@ -1,4 +1,4 @@
1
- import{jsxs as o,Fragment as e,jsx as i}from"react/jsx-runtime";import{useTheme as t,Box as l}from"@mui/material";import{OptionLine as n}from"../Line/OptionLine.js";import{FoodsIcon as r}from"../../../../Icons/FoodsIcon.js";import{FoodsSearch as s}from"../../../../Search/FoodsSearch.js";import{useFoodsSelectContext as c}from"../../Context/useSelect.js";const m=m=>{const{selectedOption:p,onChange:a,getIcon:d,getName:x}=m,{noValue:u,disableSearch:f}=c(),h=t(),g=((o,e)=>void 0===e||null===o?null:e(o))(p,d),S=null===p?"":x(p);/* @__PURE__ */
2
- return o(e,{children:[!1===f&&/* @__PURE__ */i(l,{sx:{width:"90%",position:"relative",left:"5%",marginBottom:"10px"},children:/* @__PURE__ */i(s,{})}),
3
- /* @__PURE__ */o(l,{sx:{display:"fleX",flexDirection:"column",gap:"4px"},children:[u&&/* @__PURE__ */i(n,{isSelected:!1,icon:/* @__PURE__ */i(r,{size:1,icon:"close"}),displayText:u,onClick:()=>a(null)}),null!==p&&/* @__PURE__ */i(n,{isSelected:!0,icon:g,displayText:S}),
4
- /* @__PURE__ */i(l,{sx:{marginBlock:"4px",borderBottom:`1px solid ${h.custom.grey[500]}`}})]})]})};export{m as OptionsHeader};
1
+ import{jsxs as o,Fragment as e,jsx as i}from"react/jsx-runtime";import{useTheme as t,Box as l}from"@mui/material";import{OptionLine as n}from"../Line/OptionLine.js";import{FoodsIcon as r}from"../../../../Icons/FoodsIcon.js";import{FoodsSearch as s}from"../../../../Search/FoodsSearch.js";import{useFoodsSelectContext as c}from"../../Context/useSelect.js";const m={width:"90%",position:"relative",left:"5%",marginBottom:"10px"},d=d=>{const{selectedOption:p,onChange:a,getIcon:x,getName:u}=d,{noValue:f,disableSearch:h,filterControls:g}=c(),S=t(),j=((o,e)=>void 0===e||null===o?null:e(o))(p,x),y=null===p?"":u(p);/* @__PURE__ */
2
+ return o(e,{children:[!1===h&&/* @__PURE__ */i(l,{sx:m,children:/* @__PURE__ */i(s,{})}),void 0!==g&&/* @__PURE__ */i(l,{sx:m,children:g}),
3
+ /* @__PURE__ */o(l,{sx:{display:"fleX",flexDirection:"column",gap:"4px"},children:[f&&/* @__PURE__ */i(n,{isSelected:!1,icon:/* @__PURE__ */i(r,{size:1,icon:"close"}),displayText:f,onClick:()=>a(null)}),null!==p&&/* @__PURE__ */i(n,{isSelected:!0,icon:j,displayText:y}),
4
+ /* @__PURE__ */i(l,{sx:{marginBlock:"4px",borderBottom:`1px solid ${S.custom.grey[500]}`}})]})]})};export{d as OptionsHeader};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.23.0",
4
+ "version": "2.24.0",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",