@foodpilot/foods 2.11.13 → 2.11.15

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,12 +1,11 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useTheme, ButtonGroup, Button, Box, Typography } from "@mui/material";
2
+ import { ButtonGroup, Button, Box } from "@mui/material";
3
3
  import { useState, Fragment } from "react";
4
4
  import { LinkAction } from "./LinkAction.js";
5
5
  import { CustomRender } from "./CustomRender.js";
6
6
  import { Separator } from "./Separator.js";
7
7
  import { FoodsIcon } from "../../../../../Icons/FoodsIcon.js";
8
8
  const DrawerAction = (props) => {
9
- const theme = useTheme();
10
9
  const { button, isExpanded, extendSidebar, onMobileDrawerClose } = props;
11
10
  const isOneButtonSelected = button.items.some((value) => {
12
11
  if (value.type === "separator") return false;
@@ -54,20 +53,17 @@ const DrawerAction = (props) => {
54
53
  children: [
55
54
  button.icon,
56
55
  isExpanded && /* @__PURE__ */ jsx(
57
- Typography,
56
+ Box,
58
57
  {
59
58
  sx: {
60
- color: theme.custom.grey[100],
61
- flexWrap: "nowrap",
62
- flex: 1,
63
- textAlign: "left",
64
59
  display: "-webkit-box",
65
60
  WebkitLineClamp: 1,
66
- WebkitBoxOrient: "vertical",
61
+ flex: 1,
67
62
  overflow: "hidden",
68
- textOverflow: "ellipsis"
63
+ WebkitBoxOrient: "vertical",
64
+ textOverflow: "ellipsis",
65
+ textAlign: "left"
69
66
  },
70
- variant: "body-bold",
71
67
  children: button.label
72
68
  }
73
69
  )
@@ -28,7 +28,12 @@ const SpecialTab = styled((props) => {
28
28
  // <Typography>SomethingSomething</Typography>
29
29
  "&.Mui-selected span": {
30
30
  color: theme.palette.primary[600]
31
- }
31
+ },
32
+ // The default is at 8px, but we want to align in a custom way
33
+ ".MuiTab-icon": {
34
+ marginRight: 0
35
+ },
36
+ paddingInline: 0
32
37
  };
33
38
  }
34
39
  if (variant === "secondary") {
@@ -5,14 +5,15 @@ import { StyledComponent } from '@emotion/styled';
5
5
  import { CommonProps } from '@mui/material/OverridableComponent';
6
6
  import { MUIStyledCommonProps } from '@mui/system';
7
7
  export type TabVariants = "primary" | "secondary" | "buttons";
8
- export type FoodsTabTemplateOption = {
8
+ export type FoodsTabTemplateOption<IdType = unknown> = {
9
+ id?: IdType;
9
10
  name: ReactNode;
10
11
  icon?: IconMappingProps;
11
12
  disabled?: boolean;
12
13
  TabProps?: TabProps;
13
14
  };
14
- export type FoodsTabsProps = {
15
- tabs: FoodsTabTemplateOption[];
15
+ export type FoodsTabsProps<IdType = unknown> = {
16
+ tabs: FoodsTabTemplateOption<IdType>[];
16
17
  tabVariant: TabVariants;
17
18
  textVariant?: TypographyProps["variant"];
18
19
  selectedTabIndex?: number;
@@ -25,7 +26,7 @@ export type FoodsTabsProps = {
25
26
  TabsProps?: TabsProps;
26
27
  TabProps?: TabProps;
27
28
  };
28
- export declare const FoodsTabs: (props: FoodsTabsProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const FoodsTabs: <IdType>(props: FoodsTabsProps<IdType>) => import("react/jsx-runtime").JSX.Element;
29
30
  export declare const SpecialTabs: StyledComponent< TabsOwnProps & CommonProps & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
30
31
  ref?: ((instance: HTMLDivElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLDivElement> | null | undefined;
31
32
  }, "className" | "classes" | "style" | "children" | "aria-label" | "aria-labelledby" | "onChange" | "sx" | "slots" | "slotProps" | "variant" | "orientation" | "value" | "action" | "allowScrollButtonsMobile" | "centered" | "indicatorColor" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "textColor" | "visibleScrollbar"> & {
@@ -24,6 +24,7 @@ const FoodsTabs = (props) => {
24
24
  useEffect(() => {
25
25
  _setValue(selectedTabIndex);
26
26
  }, [selectedTabIndex]);
27
+ const buttonGap = props.tabVariant === "primary" ? "20px" : "0px";
27
28
  return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, ...BoxProps2, children: /* @__PURE__ */ jsx(
28
29
  SpecialTabs,
29
30
  {
@@ -35,6 +36,13 @@ const FoodsTabs = (props) => {
35
36
  "aria-label": "section-tabs",
36
37
  variant: isScrollable ? "scrollable" : "standard",
37
38
  tabVariant,
39
+ slotProps: {
40
+ list: {
41
+ sx: {
42
+ gap: buttonGap
43
+ }
44
+ }
45
+ },
38
46
  ...TabsProps2,
39
47
  children: tabs.map((tab, tabIndex) => {
40
48
  const extraTabProps = {
@@ -96,7 +104,9 @@ const SpecialTabs = styled((props) => {
96
104
  // This is the border that shows the selected item below it
97
105
  // or on the side of it when it's horizontal
98
106
  ".MuiTabs-indicator": {
99
- backgroundColor: theme.palette.background.paper
107
+ display: "none"
108
+ // backgroundColor: theme.palette.background.paper,
109
+ // backgroundColor: theme.palette.background.paper,
100
110
  },
101
111
  ".MuiTabs-flexContainer::after": {
102
112
  content: '" "',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.11.13",
4
+ "version": "2.11.15",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",