@foodpilot/foods 0.1.21 → 0.1.23

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,10 +1,11 @@
1
1
  import { Dispatch, SetStateAction } from "react";
2
+ import { DialogProps } from "@mui/material/Dialog";
2
3
  type Settings = {
3
4
  title: JSX.Element;
4
5
  content: JSX.Element;
5
6
  error?: JSX.Element;
6
7
  };
7
- type PrimaryDialogProps = {
8
+ type PrimaryDialogProps = DialogProps & {
8
9
  isOpen: boolean;
9
10
  setOpen: Dispatch<SetStateAction<boolean>>;
10
11
  options: Settings;
package/dist/main.d.ts CHANGED
@@ -2,7 +2,7 @@ export { AccordionProduct, GenericAccordion } from "./components/Accordion";
2
2
  export { CategoryBox, DottedBox, InfoBox, LineGroupBox, QuoteBox, SolidGreyBox, WarningBox } from "./components/Box";
3
3
  export { TertiaryToggleButton } from "./components/Button";
4
4
  export { TextArrowList, TextTitle, TextTitleGreyIcon } from "./components/Text";
5
- export { PrimaryCheckbox } from "./components/Checkbox";
5
+ export * from "./components/Checkbox";
6
6
  export { PrimaryDialog } from "./components/Dialog";
7
7
  export { NumberField, TextField } from "./components/Field";
8
8
  export { FormBase } from "./components/Form";
package/dist/main.js CHANGED
@@ -27722,13 +27722,45 @@ const vz = (e) => {
27722
27722
  },
27723
27723
  `${a}-${c}`
27724
27724
  )) });
27725
- }, $z = (e) => {
27726
- const { t } = Ds(), { isOpen: o, setOpen: r, options: s } = e, { canValidate: i = !0 } = e, a = () => r(!1), l = () => {
27727
- e.onCancel && e.onCancel(), a();
27728
- }, c = () => {
27729
- a(), e.onValidate && e.onValidate();
27725
+ }, $z = (e, t, o) => {
27726
+ const r = e.filter((i) => {
27727
+ const a = t[i.id];
27728
+ return t[i.id] = {
27729
+ ...a,
27730
+ state: !1
27731
+ }, !!a;
27732
+ });
27733
+ return Object.entries(t).reduce((i, [a, l]) => {
27734
+ if (l.state) {
27735
+ const c = o({ id: a, displayName: l.name });
27736
+ i.push(c);
27737
+ }
27738
+ return i;
27739
+ }, r);
27740
+ }, Mz = (e, t) => {
27741
+ const o = {}, r = e.reduce((i, a) => (i[a.id] = {
27742
+ name: a.displayName,
27743
+ state: !0
27744
+ }, i), o);
27745
+ return t.reduce((i, a) => (i[a.id] === void 0 && (i[a.id] = {
27746
+ name: a.displayName,
27747
+ state: !1
27748
+ }), i), r);
27749
+ }, kz = (e) => {
27750
+ const { t } = Ds(), {
27751
+ isOpen: o,
27752
+ setOpen: r,
27753
+ options: s,
27754
+ onValidate: i,
27755
+ onCancel: a,
27756
+ canValidate: l = !0,
27757
+ ...c
27758
+ } = e, u = () => r(!1), d = () => {
27759
+ a && a(), u();
27760
+ }, f = () => {
27761
+ i && i(), u();
27730
27762
  };
27731
- return /* @__PURE__ */ p.jsxs(qg, { onClose: l, open: o, fullWidth: !0, maxWidth: "sm", children: [
27763
+ return /* @__PURE__ */ p.jsxs(qg, { onClose: d, ...c, open: o, children: [
27732
27764
  /* @__PURE__ */ p.jsxs(
27733
27765
  EO,
27734
27766
  {
@@ -27741,7 +27773,7 @@ const vz = (e) => {
27741
27773
  },
27742
27774
  children: [
27743
27775
  s.title,
27744
- /* @__PURE__ */ p.jsx(Yt, { variant: "text", endIcon: /* @__PURE__ */ p.jsx(zc, {}), onClick: l })
27776
+ /* @__PURE__ */ p.jsx(Yt, { variant: "text", endIcon: /* @__PURE__ */ p.jsx(zc, {}), onClick: d })
27745
27777
  ]
27746
27778
  }
27747
27779
  ),
@@ -27758,8 +27790,8 @@ const vz = (e) => {
27758
27790
  paddingInline: "1rem"
27759
27791
  },
27760
27792
  children: [
27761
- /* @__PURE__ */ p.jsx(Yt, { variant: "text", onClick: l, children: t("Annuler") }),
27762
- /* @__PURE__ */ p.jsx(Yt, { variant: "primary", onClick: c, disabled: !i, children: t("Valider") })
27793
+ /* @__PURE__ */ p.jsx(Yt, { variant: "text", onClick: d, children: t("Annuler") }),
27794
+ /* @__PURE__ */ p.jsx(Yt, { variant: "primary", onClick: f, disabled: !l, children: t("Valider") })
27763
27795
  ]
27764
27796
  }
27765
27797
  )
@@ -27782,7 +27814,7 @@ const vz = (e) => {
27782
27814
  }
27783
27815
  }
27784
27816
  );
27785
- }), Mz = (e) => {
27817
+ }), Dz = (e) => {
27786
27818
  const { title: t, unit: o, placeholder: r, value: s, description: i, ...a } = e;
27787
27819
  return /* @__PURE__ */ p.jsxs(
27788
27820
  "div",
@@ -27824,7 +27856,7 @@ const vz = (e) => {
27824
27856
  ]
27825
27857
  }
27826
27858
  );
27827
- }, kz = ql(function(t) {
27859
+ }, Iz = ql(function(t) {
27828
27860
  const { title: o, placeholder: r, value: s, description: i, sx: a, ...l } = t;
27829
27861
  return /* @__PURE__ */ p.jsxs(
27830
27862
  "div",
@@ -27981,7 +28013,7 @@ const vz = (e) => {
27981
28013
  ]
27982
28014
  }
27983
28015
  );
27984
- }, Dz = (e) => {
28016
+ }, _z = (e) => {
27985
28017
  const { title: t, icon: o, pages: r } = e, { t: s } = Ds(), i = 1, a = r.length, [l, c] = ut(i), u = (m) => {
27986
28018
  e.onPageChange != null && e.onPageChange(m), m > a ? c(a) : m < i ? c(i) : c(m);
27987
28019
  }, d = r.map((m) => m.smallIcon), f = r[l - 1], g = Array.isArray(f.content) ? f.content : [f.content];
@@ -46512,7 +46544,7 @@ const z5 = Object.assign(Object.assign({}, Bn), {
46512
46544
  };
46513
46545
  return p.jsxs(fk, Object.assign({ stickyHeader: a || h }, v, { style: Object.assign(Object.assign({}, w), v == null ? void 0 : v.style), sx: (T) => Object.assign({ borderCollapse: "separate", display: u != null && u.startsWith("grid") ? "grid" : void 0 }, Ie(v == null ? void 0 : v.sx, T)), children: [c && p.jsx(cz, Object.assign({}, S)), d === "table-body" || m.isResizingColumn ? p.jsx(q5, Object.assign({}, S)) : p.jsx(xy, Object.assign({}, S)), l && p.jsx(K5, Object.assign({}, S))] }));
46514
46546
  }, dz = (e) => V5(U5(e));
46515
- function Iz(e) {
46547
+ function jz(e) {
46516
46548
  const t = kt(), o = {
46517
46549
  enableDensityToggle: !1,
46518
46550
  //contrôle pas utilisé
@@ -46611,7 +46643,7 @@ function Iz(e) {
46611
46643
  o.enablePagination && /* @__PURE__ */ p.jsx(Jt, { sx: { marginTop: "48px", marginBottom: "32px", marginRight: "32px" }, alignItems: "flex-end", children: /* @__PURE__ */ p.jsx(az, { table: r }) })
46612
46644
  ] });
46613
46645
  }
46614
- function _z(e) {
46646
+ function Fz(e) {
46615
46647
  return /* @__PURE__ */ p.jsx(
46616
46648
  Qe,
46617
46649
  {
@@ -46628,7 +46660,7 @@ function _z(e) {
46628
46660
  );
46629
46661
  }
46630
46662
  const wy = (e) => /* @__PURE__ */ C.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ C.createElement("circle", { cx: 8, cy: 8, r: 8, fill: "white" }), /* @__PURE__ */ C.createElement("path", { d: "M8.00005 1.77777C4.56539 1.77777 1.77783 4.56533 1.77783 7.99999C1.77783 11.4347 4.56539 14.2222 8.00005 14.2222C11.4347 14.2222 14.2223 11.4347 14.2223 7.99999C14.2223 4.56533 11.4347 1.77777 8.00005 1.77777ZM8.62228 11.1111H7.37783V9.86666H8.62228V11.1111ZM8.62228 8.62222H7.37783V4.88888H8.62228V8.62222Z", fill: "#EE3C15" }));
46631
- function jz(e) {
46663
+ function Nz(e) {
46632
46664
  let t;
46633
46665
  switch (e.grade) {
46634
46666
  case "A":
@@ -46706,7 +46738,7 @@ function jz(e) {
46706
46738
  }
46707
46739
  );
46708
46740
  }
46709
- function Fz(e) {
46741
+ function Az(e) {
46710
46742
  const t = kt();
46711
46743
  return /* @__PURE__ */ p.jsx(Qe, { component: "span", children: /* @__PURE__ */ p.jsx(
46712
46744
  nt,
@@ -46722,13 +46754,13 @@ function Fz(e) {
46722
46754
  }
46723
46755
  ) });
46724
46756
  }
46725
- function Nz(e) {
46757
+ function Vz(e) {
46726
46758
  return /* @__PURE__ */ p.jsxs(Jt, { direction: "row", alignItems: "center", children: [
46727
46759
  /* @__PURE__ */ p.jsx(Yt, { variant: "text", endIcon: /* @__PURE__ */ p.jsx(HD, {}), sx: { minWidth: "0", marginRight: "10px" }, children: e.value }),
46728
46760
  e.chain && /* @__PURE__ */ p.jsx(nt, { variant: "white-tag", children: e.tag })
46729
46761
  ] });
46730
46762
  }
46731
- function Az(e) {
46763
+ function Lz(e) {
46732
46764
  const t = kt();
46733
46765
  return /* @__PURE__ */ p.jsxs(Qe, { component: "span", sx: { display: "flex", gap: "8px" }, children: [
46734
46766
  /* @__PURE__ */ p.jsxs(
@@ -46769,7 +46801,7 @@ function Az(e) {
46769
46801
  /* @__PURE__ */ p.jsx(nt, { sx: { display: "inline", color: "#50504D" }, children: e.unit })
46770
46802
  ] });
46771
46803
  }
46772
- const Vz = (e) => {
46804
+ const zz = (e) => {
46773
46805
  const { unit: t, sx: o, ...r } = e;
46774
46806
  return /* @__PURE__ */ p.jsxs(
46775
46807
  "div",
@@ -46797,7 +46829,7 @@ const Vz = (e) => {
46797
46829
  }
46798
46830
  );
46799
46831
  };
46800
- function Lz(e) {
46832
+ function Bz(e) {
46801
46833
  const t = kt(), o = {
46802
46834
  height: "40px",
46803
46835
  padding: "0px 6px 0px 20px",
@@ -46858,7 +46890,7 @@ function Lz(e) {
46858
46890
  }
46859
46891
  );
46860
46892
  }
46861
- function zz(e) {
46893
+ function Hz(e) {
46862
46894
  return e.variant === "themed" ? /* @__PURE__ */ p.jsx(pz, { ...e }) : e.variant === "headless" ? /* @__PURE__ */ p.jsx(sm, { ...e }) : /* @__PURE__ */ p.jsx(sm, { ...e, variant: "themed" });
46863
46895
  }
46864
46896
  function pz(e) {
@@ -46917,7 +46949,7 @@ function sm(e) {
46917
46949
  }
46918
46950
  );
46919
46951
  }
46920
- function Bz(e) {
46952
+ function Wz(e) {
46921
46953
  return /* @__PURE__ */ p.jsxs(
46922
46954
  Qe,
46923
46955
  {
@@ -46984,7 +47016,7 @@ function fz(e) {
46984
47016
  )
46985
47017
  ] });
46986
47018
  }
46987
- const Hz = (e) => {
47019
+ const Uz = (e) => {
46988
47020
  const { size: t, icon: o, body: r } = e, [s, i] = ut(null), a = () => {
46989
47021
  i(null);
46990
47022
  }, l = (u) => {
@@ -47054,7 +47086,7 @@ const Hz = (e) => {
47054
47086
  }
47055
47087
  );
47056
47088
  };
47057
- function Wz(e) {
47089
+ function qz(e) {
47058
47090
  return /* @__PURE__ */ p.jsxs("div", { children: [
47059
47091
  /* @__PURE__ */ p.jsx(nt, { variant: "body-bold", sx: { marginBottom: "16px" }, children: e.header }),
47060
47092
  /* @__PURE__ */ p.jsxs(Jt, { direction: "column", useFlexGap: !0, gap: "12px", children: [
@@ -47080,7 +47112,7 @@ function Wz(e) {
47080
47112
  ] })
47081
47113
  ] });
47082
47114
  }
47083
- function Uz(e) {
47115
+ function Gz(e) {
47084
47116
  return /* @__PURE__ */ p.jsxs(Jt, { direction: "column", useFlexGap: !0, gap: "12px", alignItems: "flex-start", children: [
47085
47117
  /* @__PURE__ */ p.jsx(nt, { variant: "body-bold", children: e.header }),
47086
47118
  /* @__PURE__ */ p.jsx(Jt, { direction: "row", useFlexGap: !0, gap: "8px", flexWrap: "wrap", children: e.values.map((t, o) => /* @__PURE__ */ p.jsxs(
@@ -47101,44 +47133,46 @@ function Uz(e) {
47101
47133
  /* @__PURE__ */ p.jsx(Yt, { variant: "text", startIcon: /* @__PURE__ */ p.jsx(FD, {}), children: e.addText })
47102
47134
  ] });
47103
47135
  }
47104
- const qz = (e) => /* @__PURE__ */ p.jsx(og, { theme: _D, children: e.children });
47136
+ const Yz = (e) => /* @__PURE__ */ p.jsx(og, { theme: _D, children: e.children });
47105
47137
  export {
47106
47138
  hz as AccordionProduct,
47107
- zz as AnchoredPopover,
47108
- _z as ArrayCell,
47109
- Bz as BigPopoverLayout,
47139
+ Hz as AnchoredPopover,
47140
+ Fz as ArrayCell,
47141
+ Wz as BigPopoverLayout,
47110
47142
  Yt as Button,
47111
47143
  vz as CategoryBox,
47112
47144
  yz as DottedBox,
47113
- jz as EcoScoreCell,
47114
- Wz as FixedMultiValueFilter,
47145
+ Nz as EcoScoreCell,
47146
+ qz as FixedMultiValueFilter,
47115
47147
  _D as FoodPilotTheme,
47116
- qz as FoodsThemeProvider,
47117
- Dz as FormBase,
47148
+ Yz as FoodsThemeProvider,
47149
+ _z as FormBase,
47118
47150
  hI as FormTopBar,
47119
47151
  bz as GenericAccordion,
47120
- Fz as GreyTextCell,
47152
+ Az as GreyTextCell,
47121
47153
  fI as IconThread,
47122
47154
  xz as InfoBox,
47123
47155
  Cz as LineGroupBox,
47124
- Nz as LinkCell,
47125
- Iz as MRTGrid,
47126
- Uz as MultiValueFilter,
47127
- Mz as NumberField,
47128
- Az as PointsCell,
47156
+ Vz as LinkCell,
47157
+ jz as MRTGrid,
47158
+ Gz as MultiValueFilter,
47159
+ Dz as NumberField,
47160
+ Lz as PointsCell,
47129
47161
  Ez as PrimaryCheckbox,
47130
- $z as PrimaryDialog,
47162
+ kz as PrimaryDialog,
47131
47163
  wz as QuoteBox,
47132
47164
  Bc as RoundInput,
47133
- Vz as RoundNumberInput,
47134
- Lz as SearchBox,
47165
+ zz as RoundNumberInput,
47166
+ Bz as SearchBox,
47135
47167
  Sz as SolidGreyBox,
47136
47168
  Rz as TertiaryToggleButton,
47137
47169
  Pz as TextArrowList,
47138
- kz as TextField,
47170
+ Iz as TextField,
47139
47171
  aI as TextTitle,
47140
47172
  Oz as TextTitleGreyIcon,
47141
47173
  nt as Typography,
47142
47174
  Tz as WarningBox,
47143
- Hz as WhitePopoverOnIcon
47175
+ Uz as WhitePopoverOnIcon,
47176
+ Mz as anyToCheckbox,
47177
+ $z as checkboxToAny
47144
47178
  };