@popmenu/ordering-ui 0.90.0 → 0.92.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,25 +1,30 @@
1
- declare type ModifierValue = {
2
- id: number;
3
- price?: number;
4
- quantity?: number;
1
+ export declare type ModifierValue = Pick<Modifier, 'id' | 'price'> & {
2
+ quantity: number;
5
3
  };
6
- declare type Modifier = {
4
+ export declare type Modifier = {
7
5
  id: number;
8
6
  name: string;
9
7
  outOfStock: boolean;
10
- price?: string;
8
+ price: number;
9
+ formattedPrice: string;
10
+ quantity: number;
11
11
  };
12
- declare type OnChange = (value: Array<ModifierValue>, checked?: boolean) => void;
13
12
  interface Base {
14
13
  /** Modifier options */
15
14
  modifiers: Array<Modifier>;
16
15
  /** The values of the modifier form */
17
- value: Array<ModifierValue> | undefined;
16
+ value: Array<ModifierValue>;
18
17
  /** Handles the change event */
19
- onChange: OnChange;
18
+ onChange: (value: Array<ModifierValue>) => void;
20
19
  isOutOfStock: boolean;
21
20
  }
22
- export declare type DishModifierCardProps = Base & {
21
+ export declare type DishModifierCardProps = {
22
+ /** Modifier options */
23
+ modifiers: Array<Modifier>;
24
+ /** The values of the modifier form */
25
+ value: Array<ModifierValue>;
26
+ /** Handles the change event */
27
+ onChange: (value: Array<ModifierValue>) => void;
23
28
  /** Name of the modifier */
24
29
  name: string;
25
30
  /** Denotes the max amount of selections have been reached */
@@ -30,7 +35,8 @@ export declare type DishModifierCardProps = Base & {
30
35
  isRequired: boolean;
31
36
  /** Denotes if modifier is out of stock */
32
37
  isOutOfStock: boolean;
33
- type: 'singleSelect' | 'multipleSelect';
38
+ /** Selection type for modifier group */
39
+ type: 'singleSelect' | 'multipleSelect' | 'multipleQuantitySelect';
34
40
  /** Renders the text of the dish modifiers */
35
41
  messages: {
36
42
  optionalText: string;
@@ -43,8 +49,5 @@ export declare type RadioModifierFormProps = Base;
43
49
  export declare type CheckboxModifierFormProps = Base & {
44
50
  disableNewSelections?: boolean;
45
51
  };
46
- export declare type ModifierOptionsControlProps = Base & {
47
- disableNewSelections?: boolean;
48
- type: 'singleSelect' | 'multipleSelect';
49
- };
52
+ export declare type ModifierOptionsControlProps = Pick<DishModifierCardProps, 'value' | 'modifiers' | 'isOutOfStock' | 'onChange' | 'disableNewSelections' | 'type' | 'messages'>;
50
53
  export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ModifierOptionsControlProps } from './DishModifierCardProps';
3
+ export declare const ModifierControls: (props: ModifierOptionsControlProps) => JSX.Element | null;
@@ -1,2 +1,5 @@
1
+ import { QuantityPickerProps } from './QuantityPickerProps';
1
2
  export declare const useQuantityPickerStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"root">;
2
- export declare const useQuantityInputStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"root" | "input" | "adornedStart" | "adornedEnd">;
3
+ export declare const useQuantityInputStyles: (props: QuantityPickerProps) => import("@material-ui/styles").ClassNameMap<string>;
4
+ export declare const useStartAdornmentStyles: (props: QuantityPickerProps) => import("@material-ui/styles").ClassNameMap<string>;
5
+ export declare const useEndAdornmentStyles: (props: QuantityPickerProps) => import("@material-ui/styles").ClassNameMap<string>;
@@ -1,13 +1,19 @@
1
+ import React, { ChangeEvent } from 'react';
1
2
  export declare type QuantityChangeEvent = {
2
- target: {
3
- value: number;
4
- };
3
+ quantity: number;
4
+ reason: string;
5
5
  };
6
6
  export interface QuantityPickerProps {
7
7
  /** Callback for when the quantity is increased or decreased for the parent form */
8
- onChange: (event: QuantityChangeEvent, reason: string) => void;
8
+ onChange: (event: ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement, MouseEvent>, change: QuantityChangeEvent) => void;
9
9
  /** the quantity represented by the picker */
10
10
  value: number;
11
11
  /** determines if picker is active */
12
12
  disabled?: boolean;
13
+ /** limits the quantity picker from increasing the value */
14
+ disableIncrement?: boolean;
15
+ /** prevents a uer from typing a new value, forcing them to use the increment/decrement buttons */
16
+ preventManualChange?: boolean;
17
+ /** indicates how the quantity picker will be used and changes styles accordingly */
18
+ variation: 'itemCount' | 'modifierCount';
13
19
  }