@foodpilot/foods 2.12.0 → 2.12.2
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/components/Cards/SelectionCard/SelectionCard.d.ts +1 -0
- package/dist/components/Cards/SelectionCard/SelectionCard.js +4 -4
- package/dist/components/Cards/SelectionCard/SelectionCardGroup.d.ts +1 -0
- package/dist/components/Cards/SelectionCard/SelectionCardGroup.js +3 -3
- package/dist/components/Textarea/Textarea.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as o,jsx as e}from"react/jsx-runtime";import{useTheme as
|
|
2
|
-
return o(
|
|
3
|
-
/* @__PURE__ */o(
|
|
4
|
-
/* @__PURE__ */e(
|
|
1
|
+
import{jsxs as o,jsx as e}from"react/jsx-runtime";import{useTheme as i,Stack as r,Box as t,Typography as n}from"@mui/material";import{forwardRef as l}from"react";import{FoodsIcon as d}from"../../Icons/FoodsIcon.js";import{greyTheme as a}from"../../../themes/common/colors.js";const c=l((l,c)=>{const{title:s,description:p,icon:m,selected:x=!1,disabled:b=!1,fullWidth:h=!1,onClick:f,id:u,tabIndex:g,onKeyDown:y}=l,k=i(),C=k.palette.primary,w=k.palette.grey,I=w[100],j=C[50]??I,v=C[200]??C.main,S=C[600]??C.main,W=w[600],D=b?a[1400]:k.palette.text.primary,F=b?w[300]:x?C[100]??j:j;/* @__PURE__ */
|
|
2
|
+
return o(r,{component:"button",ref:c,id:u,type:"button",role:"radio","aria-checked":x,"aria-disabled":b,disabled:b,tabIndex:g,onClick:()=>{b||f?.()},onKeyDown:y,direction:"row",alignItems:"center",gap:k.spacing(2),sx:{width:h?"100%":"306px",flex:h?1:"0 0 auto",minWidth:0,minHeight:"82px",padding:k.spacing(2),border:`1px solid ${b?W:x?S:v}`,borderRadius:"12px",backgroundColor:x?j:I,boxShadow:"0px 2px 8px 0px rgba(42, 43, 39, 0.04)",color:D,cursor:b?"not-allowed":"pointer",font:"inherit",textAlign:"left",transition:"background-color 150ms ease, border-color 150ms ease","&:hover":b?void 0:{backgroundColor:j,borderColor:S},"&:focus-visible":{outline:`2px solid ${S}`,outlineOffset:"2px"}},children:[m&&/* @__PURE__ */e(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,padding:k.spacing(1),borderRadius:"12px",backgroundColor:F,color:D},children:m}),
|
|
3
|
+
/* @__PURE__ */o(r,{flex:1,justifyContent:"center",minWidth:0,children:[
|
|
4
|
+
/* @__PURE__ */e(n,{variant:"body-semibold",color:"inherit",children:s}),p&&/* @__PURE__ */e(n,{variant:"small",color:"inherit",children:p})]}),x&&/* @__PURE__ */e(t,{flexShrink:0,color:S,children:/* @__PURE__ */e(d,{icon:"checkCircleFilled",size:2})})]})});c.displayName="SelectionCard";export{c as SelectionCard};
|
|
@@ -12,5 +12,6 @@ export type SelectionCardGroupProps<T extends string | number = string> = {
|
|
|
12
12
|
onChange: (id: T) => void;
|
|
13
13
|
direction?: "row" | "column";
|
|
14
14
|
name?: string;
|
|
15
|
+
fullWidth?: boolean;
|
|
15
16
|
};
|
|
16
17
|
export declare const SelectionCardGroup: <T extends string | number = string>(props: SelectionCardGroupProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{Stack as e}from"@mui/material";import{useRef as t,useMemo as i}from"react";import{SelectionCard as n}from"./SelectionCard.js";const o=o=>{const{options:d,value:
|
|
2
|
-
return r(e,{role:"radiogroup","aria-label":a,direction:s,gap:
|
|
3
|
-
return r(n,{ref:r=>{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{Stack as e}from"@mui/material";import{useRef as t,useMemo as i}from"react";import{SelectionCard as n}from"./SelectionCard.js";const o=o=>{const{options:d,value:l,onChange:c,direction:s="row",name:a,fullWidth:u=!1}=o,f=t([]),w=i(()=>d.map((r,e)=>r.disabled?null:e).filter(r=>null!==r),[d]),m=d.findIndex(r=>r.id===l),p=w[0]??-1;/* @__PURE__ */
|
|
2
|
+
return r(e,{role:"radiogroup","aria-label":a,direction:s,gap:3,onKeyDown:r=>{const e="row"===s?["ArrowRight","ArrowDown"]:["ArrowDown","ArrowRight"],t="row"===s?["ArrowLeft","ArrowUp"]:["ArrowUp","ArrowLeft"];if(e.includes(r.key)||t.includes(r.key)){r.preventDefault();const t=(r=>{const e=f.current.findIndex(e=>e===r.target);return-1!==e?e:-1!==m?m:p})(r),i=((r,e)=>{if(0===w.length)return-1;const t=w.indexOf(r),i=((-1===t?0:t)+e+w.length)%w.length;return w[i]})(t,e.includes(r.key)?1:-1);(r=>{const e=d[r];e&&!e.disabled&&(c(e.id),f.current[r]?.focus())})(i)}},alignItems:u&&"row"===s?"stretch":void 0,sx:{width:u?"100%":"fit-content"},children:d.map((e,t)=>{const i=e.id===l,o=i||-1===m&&t===p;/* @__PURE__ */
|
|
3
|
+
return r(n,{ref:r=>{f.current[t]=r},id:String(e.id),title:e.title,description:e.description,icon:e.icon,selected:i,disabled:e.disabled,fullWidth:u,tabIndex:e.disabled?void 0:o?0:-1,onClick:()=>c(e.id)},e.id)})})};export{o as SelectionCardGroup};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsxs as r,jsx as o}from"react/jsx-runtime";import{useTheme as e,Stack as a,Typography as n,styled as l,TextareaAutosize as
|
|
2
|
-
return r(a,{gap:
|
|
3
|
-
/* @__PURE__ */o(n,{variant:"small-regular",color:
|
|
1
|
+
import{jsxs as r,jsx as o}from"react/jsx-runtime";import{useTheme as e,Stack as a,Typography as n,styled as l,TextareaAutosize as t}from"@mui/material";import{redTheme as i,greyTheme as s}from"../../themes/common/colors.js";const d=l=>{const t=e(),{value:d,onChange:u,onBlur:h,onFocus:p,placeholder:m,variant:g="primary",disabled:b=!1,error:x=!1,errorMessage:v,maxLength:f,minRows:y,maxRows:C=14,content:w}=l,E=void 0!==d,$=E?d.length:0,k=void 0!==f&&$>f,F=x||k,R=void 0!==f||void 0!==v,j=E?{value:d,onChange:r=>u?.(r.currentTarget.value)}:{defaultValue:w};/* @__PURE__ */
|
|
2
|
+
return r(a,{gap:t.spacing(.5),width:"100%",children:[c(g,b,{...j,onBlur:h,onFocus:p,placeholder:m,disabled:b,minRows:y,maxRows:C,maxLength:f,$hasError:F}),R&&/* @__PURE__ */r(a,{flexDirection:"row",justifyContent:"space-between",gap:t.spacing(1),px:t.spacing(2.5),children:[
|
|
3
|
+
/* @__PURE__ */o(n,{variant:"small-regular",color:F?i[600]:"transparent",sx:{minHeight:"1em"},children:F&&v?v:" "}),void 0!==f&&/* @__PURE__ */r(n,{variant:"small-regular",color:k?i[600]:s[1500],children:[$," / ",f]})]})]})},c=(r,e,a)=>{if(e)/* @__PURE__ */return o(g,{...a});switch(r){case"secondary":/* @__PURE__ */
|
|
4
4
|
return o(p,{...a});case"tertiary":/* @__PURE__ */
|
|
5
5
|
return o(m,{...a});case"disabled":/* @__PURE__ */
|
|
6
6
|
return o(g,{...a});default:/* @__PURE__ */
|
|
7
|
-
return o(h,{...a})}},u=l(
|
|
7
|
+
return o(h,{...a})}},u=l(t,{shouldForwardProp:r=>"$hasError"!==r})(({theme:r,$hasError:o})=>({width:"100%",lineHeight:"22px",padding:"20px 24px 60px 24px",borderRadius:"12px",resize:"none",...r.typography.body,fontFamily:r.typography.fontFamily,color:s[2800],borderColor:o?i[600]:s[500],"&:focus-visible":{outline:"0",borderColor:o?i[600]:s[2800]},...o&&{backgroundColor:i[100],color:i[600]}})),h=l(u)(({$hasError:r})=>({backgroundColor:r?i[100]:s[100]})),p=l(u)(({$hasError:r})=>({backgroundColor:r?i[100]:s[300]})),m=l(u)(({$hasError:r})=>({borderColor:r?i[600]:s[2800],backgroundColor:r?i[100]:s[100]})),g=l(u)({color:s[2e3],backgroundColor:s[500]});export{d as Textarea};
|