@foodpilot/foods 2.9.0 → 2.10.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.
@@ -1,9 +1,10 @@
1
1
  import { WidthHeight, iconMapping } from './iconConfig';
2
2
  export type IconMapping = typeof iconMapping;
3
+ export type IconMappingProps = keyof IconMapping | (string & {}) | undefined;
3
4
  type Size = WidthHeight | number;
4
5
  export type FoodsIconProps = {
5
6
  size: Size;
6
- icon: keyof IconMapping | (string & {}) | undefined;
7
+ icon: IconMappingProps;
7
8
  placeholder?: "empty" | "blank" | "defaultIcon";
8
9
  backgroundColor?: string;
9
10
  color?: string;
@@ -0,0 +1,9 @@
1
+ import { TabProps, TypographyProps, Theme } from '@mui/material';
2
+ import { TabVariants } from './FoodsTabs';
3
+ import { StyledComponent } from '@emotion/styled';
4
+ import { MUIStyledCommonProps } from '@mui/system';
5
+ export declare const SpecialTab: StyledComponent<Omit<TabProps, "icon"> & {
6
+ variant: TabVariants;
7
+ isSelected: boolean;
8
+ textVariant: TypographyProps["variant"];
9
+ } & MUIStyledCommonProps<Theme>, {}, {}>;
@@ -0,0 +1,35 @@
1
+ import { BoxProps, TabProps, TabsProps, TypographyProps, TabsOwnProps, Theme } from '@mui/material';
2
+ import { ReactNode, DetailedHTMLProps, HTMLAttributes, DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES, RefObject } from 'react';
3
+ import { IconMappingProps } from '../../Icons';
4
+ import { StyledComponent } from '@emotion/styled';
5
+ import { CommonProps } from '@mui/material/OverridableComponent';
6
+ import { MUIStyledCommonProps } from '@mui/system';
7
+ export type TabVariants = "primary" | "secondary" | "buttons";
8
+ export type FoodsTabTemplateOption = {
9
+ name: ReactNode;
10
+ icon?: IconMappingProps;
11
+ disabled?: boolean;
12
+ TabProps?: TabProps;
13
+ };
14
+ export type FoodsTabsProps = {
15
+ tabs: FoodsTabTemplateOption[];
16
+ tabVariant: TabVariants;
17
+ textVariant?: TypographyProps["variant"];
18
+ selectedTabIndex?: number;
19
+ /**
20
+ * Force scrollable behavior even on desktop.
21
+ * If not provided, scrollable will be automatically enabled on mobile devices.
22
+ */
23
+ forceScrollable?: boolean;
24
+ BoxProps?: BoxProps;
25
+ TabsProps?: TabsProps;
26
+ TabProps?: TabProps;
27
+ };
28
+ export declare const FoodsTabs: (props: FoodsTabsProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const SpecialTabs: StyledComponent< TabsOwnProps & CommonProps & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
30
+ 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
+ }, "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"> & {
32
+ component?: React.ElementType;
33
+ } & {
34
+ tabVariant: TabVariants;
35
+ } & MUIStyledCommonProps<Theme>, {}, {}>;
package/dist/main.js CHANGED
@@ -143,6 +143,8 @@ import { BredTheme, BredThemeOptions } from "./themes/themes/BredTheme.js";
143
143
  import { CollectiveTheme, CollectiveThemeOptions } from "./themes/themes/CollectiveTheme.js";
144
144
  import { FoodPilotTheme, FoodpilotThemeOptions } from "./themes/themes/FoodPilotTheme.js";
145
145
  import { WinePilotTheme, WinepilotThemeOptions } from "./themes/themes/WinePilotTheme.js";
146
+ import { useResponsivePadding } from "./themes/responsive/useResponsivePadding.js";
147
+ import { useResponsiveBreakpoints } from "./themes/responsive/useResponsiveBreakpoints.js";
146
148
  import { FoodsThemeOptionsProvider, FoodsThemeProvider } from "./themes/FoodsThemeProvider.js";
147
149
  export {
148
150
  AccordionProduct,
@@ -324,5 +326,7 @@ export {
324
326
  themes,
325
327
  typographyConfig,
326
328
  useFormBaseContext,
329
+ useResponsiveBreakpoints,
330
+ useResponsivePadding,
327
331
  yellowTheme
328
332
  };
@@ -11,3 +11,4 @@ export declare const getThemeLogo: (theme: string) => React.FunctionComponent<Re
11
11
  export { FoodsThemeProvider, FoodsThemeOptionsProvider };
12
12
  export * from './common';
13
13
  export * from './themes';
14
+ export * from './responsive';
@@ -0,0 +1,2 @@
1
+ export { useResponsivePadding } from './useResponsivePadding';
2
+ export { useResponsiveBreakpoints } from './useResponsiveBreakpoints';
@@ -0,0 +1,6 @@
1
+ export declare const useResponsiveBreakpoints: () => {
2
+ isMobile: boolean;
3
+ isTablet: boolean;
4
+ isDesktop: boolean;
5
+ isUltrawide: boolean;
6
+ };
@@ -0,0 +1,18 @@
1
+ import { useTheme } from "@mui/material/styles";
2
+ import { useMediaQuery } from "@mui/material";
3
+ const useResponsiveBreakpoints = () => {
4
+ const theme = useTheme();
5
+ const isMobile = useMediaQuery(theme.breakpoints.down("md"));
6
+ const isTablet = useMediaQuery(theme.breakpoints.between("md", "lg"));
7
+ const isDesktop = useMediaQuery(theme.breakpoints.between("lg", "xl"));
8
+ const isUltrawide = useMediaQuery(theme.breakpoints.up("xl"));
9
+ return {
10
+ isMobile,
11
+ isTablet,
12
+ isDesktop,
13
+ isUltrawide
14
+ };
15
+ };
16
+ export {
17
+ useResponsiveBreakpoints
18
+ };
@@ -0,0 +1 @@
1
+ export declare const useResponsivePadding: () => "0.5rem" | "2rem" | "1.5rem" | "2.5rem";
@@ -0,0 +1,12 @@
1
+ import { useResponsiveBreakpoints } from "./useResponsiveBreakpoints.js";
2
+ const useResponsivePadding = () => {
3
+ const { isMobile, isTablet, isDesktop, isUltrawide } = useResponsiveBreakpoints();
4
+ if (isMobile) return "0.5rem";
5
+ if (isTablet) return "1.5rem";
6
+ if (isDesktop) return "2rem";
7
+ if (isUltrawide) return "2.5rem";
8
+ return "2rem";
9
+ };
10
+ export {
11
+ useResponsivePadding
12
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "2.9.0",
4
+ "version": "2.10.0",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "module": "./dist/main.js",