@saleor/macaw-ui 0.3.2 → 0.5.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.
Files changed (118) hide show
  1. package/README.md +20 -0
  2. package/dist/cjs/index.js +2 -2
  3. package/dist/cjs/index.js.map +3 -3
  4. package/dist/esm/index.js +2 -2
  5. package/dist/esm/index.js.map +3 -3
  6. package/dist/types/ActionBar/ActionBar.d.ts +1 -0
  7. package/dist/types/ActionBar/context.d.ts +6 -3
  8. package/dist/types/Autocomplete/Autocomplete.d.ts +23 -0
  9. package/dist/types/Autocomplete/Autocomplete.stories.d.ts +5 -0
  10. package/dist/types/Autocomplete/fixtures.d.ts +4 -0
  11. package/dist/types/Autocomplete/index.d.ts +1 -0
  12. package/dist/types/Autocomplete/styles.d.ts +2 -0
  13. package/dist/types/Chip/Chip.d.ts +8 -0
  14. package/dist/types/Chip/ChipAdornment.d.ts +6 -0
  15. package/dist/types/Chip/ChipMovable.d.ts +5 -0
  16. package/dist/types/Chip/ChipRemovable.d.ts +6 -0
  17. package/dist/types/Chip/ChipSwatch.d.ts +7 -0
  18. package/dist/types/Chip/index.d.ts +5 -0
  19. package/dist/types/Chip/private/ColorSwatch.d.ts +6 -0
  20. package/dist/types/Chip/styles.d.ts +2 -0
  21. package/dist/types/CircleIndicator/index.d.ts +1 -1
  22. package/dist/types/Filter/FilterField/AutocompleteFilterField.d.ts +6 -0
  23. package/dist/types/Filter/FilterField/MultipleValueAutocompleteFilterField.d.ts +6 -0
  24. package/dist/types/Filter/stories/Filter.stories.d.ts +5 -0
  25. package/dist/types/Filter/stories/FilterInteractive.stories.d.ts +4 -0
  26. package/dist/types/Filter/stories/labels.d.ts +8 -0
  27. package/dist/types/Filter/styles.d.ts +1 -1
  28. package/dist/types/Filter/types.d.ts +8 -2
  29. package/dist/types/Filter/utils.d.ts +4 -1
  30. package/dist/types/IconButton/IconButton.d.ts +2 -0
  31. package/dist/types/IconButton/partials.d.ts +1 -1
  32. package/dist/types/IconButton/styles.d.ts +1 -1
  33. package/dist/types/MultipleValueAutocomplete/MultipleValueAutocomplete.d.ts +26 -0
  34. package/dist/types/MultipleValueAutocomplete/MultipleValueAutocomplete.stories.d.ts +6 -0
  35. package/dist/types/MultipleValueAutocomplete/fixtures.d.ts +4 -0
  36. package/dist/types/MultipleValueAutocomplete/index.d.ts +1 -0
  37. package/dist/types/MultipleValueAutocomplete/styles.d.ts +2 -0
  38. package/dist/types/MultipleValueAutocomplete/useMultipleValueAutocomplete.d.ts +32 -0
  39. package/dist/types/Savebar/Savebar.d.ts +1 -0
  40. package/dist/types/Sidebar/MenuItem.d.ts +9 -3
  41. package/dist/types/Sidebar/types.d.ts +8 -0
  42. package/dist/types/Sidebar/utils.d.ts +12 -0
  43. package/dist/types/SidebarDrawer/MenuItemBtn.d.ts +2 -1
  44. package/dist/types/SwitchSelector/SwitchSelector.d.ts +2 -0
  45. package/dist/types/SwitchSelector/SwitchSelector.stories.d.ts +4 -0
  46. package/dist/types/SwitchSelector/SwitchSelectorButton.d.ts +8 -0
  47. package/dist/types/SwitchSelector/index.d.ts +2 -0
  48. package/dist/types/index.d.ts +3 -0
  49. package/dist/types/theme/ThemeProvider.d.ts +4 -0
  50. package/dist/types/theme/types.d.ts +1 -0
  51. package/dist/types/tools/useTextWidth.d.ts +2 -0
  52. package/dist/types/utils/guideStyles.d.ts +1 -1
  53. package/dist/types/utils/mergeRefs.d.ts +2 -0
  54. package/dist/types/utils/useMockAutocomplete.d.ts +10 -0
  55. package/package.json +11 -13
  56. package/src/ActionBar/ActionBar.tsx +8 -11
  57. package/src/ActionBar/context.tsx +15 -6
  58. package/src/ActionBar/styles.ts +1 -1
  59. package/src/Autocomplete/Autocomplete.stories.tsx +43 -0
  60. package/src/Autocomplete/Autocomplete.tsx +187 -0
  61. package/src/Autocomplete/fixtures.ts +122 -0
  62. package/src/Autocomplete/index.ts +1 -0
  63. package/src/Autocomplete/styles.ts +19 -0
  64. package/src/Backlink/Backlink.tsx +3 -1
  65. package/src/Chip/Chip.tsx +52 -0
  66. package/src/Chip/ChipAdornment.tsx +53 -0
  67. package/src/Chip/ChipMovable.tsx +40 -0
  68. package/src/Chip/ChipRemovable.tsx +29 -0
  69. package/src/Chip/ChipSwatch.tsx +42 -0
  70. package/src/Chip/index.ts +5 -0
  71. package/src/Chip/private/ColorSwatch.tsx +21 -0
  72. package/src/Chip/styles.ts +46 -0
  73. package/src/CircleIndicator/CircleIndicator.stories.tsx +6 -6
  74. package/src/CircleIndicator/index.ts +1 -1
  75. package/src/Filter/Filter.tsx +88 -44
  76. package/src/Filter/FilterBar.tsx +15 -9
  77. package/src/Filter/FilterContent.tsx +8 -1
  78. package/src/Filter/FilterField/AutocompleteFilterField.tsx +61 -0
  79. package/src/Filter/FilterField/MultipleSelectFilterField.tsx +9 -3
  80. package/src/Filter/FilterField/MultipleValueAutocompleteFilterField.tsx +60 -0
  81. package/src/Filter/context.tsx +1 -1
  82. package/src/Filter/{Filter.stories.tsx → stories/Filter.stories.tsx} +47 -13
  83. package/src/Filter/stories/FilterInteractive.stories.tsx +97 -0
  84. package/src/Filter/stories/labels.ts +8 -0
  85. package/src/Filter/styles.ts +37 -6
  86. package/src/Filter/types.ts +8 -1
  87. package/src/Filter/utils.ts +71 -5
  88. package/src/IconButton/IconButton.tsx +17 -2
  89. package/src/IconButton/partials.ts +1 -1
  90. package/src/IconButton/styles.ts +38 -16
  91. package/src/MultipleValueAutocomplete/MultipleValueAutocomplete.stories.tsx +76 -0
  92. package/src/MultipleValueAutocomplete/MultipleValueAutocomplete.tsx +185 -0
  93. package/src/MultipleValueAutocomplete/fixtures.ts +122 -0
  94. package/src/MultipleValueAutocomplete/index.ts +1 -0
  95. package/src/MultipleValueAutocomplete/styles.ts +39 -0
  96. package/src/MultipleValueAutocomplete/useMultipleValueAutocomplete.ts +172 -0
  97. package/src/Savebar/Savebar.tsx +3 -4
  98. package/src/Sidebar/MenuItem.tsx +35 -14
  99. package/src/Sidebar/Sidebar.tsx +27 -11
  100. package/src/Sidebar/types.ts +9 -0
  101. package/src/Sidebar/utils.ts +23 -0
  102. package/src/SidebarDrawer/MenuItemBtn.tsx +12 -6
  103. package/src/SidebarDrawer/SidebarDrawer.tsx +8 -2
  104. package/src/SwitchSelector/SwitchSelector.stories.tsx +63 -0
  105. package/src/SwitchSelector/SwitchSelector.tsx +19 -0
  106. package/src/SwitchSelector/SwitchSelectorButton.tsx +59 -0
  107. package/src/SwitchSelector/index.ts +2 -0
  108. package/src/index.tsx +4 -1
  109. package/src/theme/ThemeProvider.tsx +6 -0
  110. package/src/theme/createSaleorTheme/createSaleorTheme.tsx +2 -1
  111. package/src/theme/createSaleorTheme/overrides/controls.ts +4 -1
  112. package/src/theme/createSaleorTheme/overrides/inputs.ts +1 -1
  113. package/src/theme/themes.ts +1 -1
  114. package/src/theme/types.ts +1 -0
  115. package/src/tools/useTextWidth.ts +20 -0
  116. package/src/utils/guideStyles.ts +5 -0
  117. package/src/utils/mergeRefs.ts +14 -0
  118. package/src/utils/useMockAutocomplete.ts +37 -0
@@ -3,6 +3,7 @@ import { ConfirmButtonTransitionState } from "../ConfirmButton";
3
3
  export interface ActionBarProps {
4
4
  disabled: boolean;
5
5
  state: ConfirmButtonTransitionState;
6
+ className?: string;
6
7
  children: React.ReactNode[] | React.ReactNode;
7
8
  }
8
9
  export declare const ActionBar: React.FC<ActionBarProps>;
@@ -1,9 +1,12 @@
1
1
  import React from "react";
2
+ declare type AnchorFunction = {
3
+ (el: HTMLDivElement): void;
4
+ current: HTMLDivElement | null;
5
+ };
2
6
  export interface ActionBarContextType {
3
- anchor: React.RefObject<HTMLDivElement>;
4
- docked: boolean;
5
- setDocked: (docked: boolean) => void;
7
+ anchor: AnchorFunction;
6
8
  }
7
9
  export declare const ActionBarContext: React.Context<ActionBarContextType | undefined>;
8
10
  export declare const useActionBar: () => ActionBarContextType;
9
11
  export declare const ActionBarProvider: React.FC;
12
+ export {};
@@ -0,0 +1,23 @@
1
+ import { PopperPlacementType } from "@material-ui/core/Popper";
2
+ import { StandardTextFieldProps } from "@material-ui/core/TextField";
3
+ import { UseComboboxGetItemPropsOptions } from "downshift";
4
+ import React from "react";
5
+ import { SyntheticChangeEvent } from "../../types/utils";
6
+ import { Choice } from "../Filter";
7
+ export interface AutocompleteProps extends StandardTextFieldProps {
8
+ children: (data: {
9
+ getItemProps: (opts: UseComboboxGetItemPropsOptions<Choice>) => any;
10
+ highlightedIndex: number;
11
+ inputValue: string;
12
+ }) => React.ReactNode | React.ReactNodeArray;
13
+ className?: string;
14
+ styles?: React.CSSProperties;
15
+ choices: Choice[];
16
+ label?: string;
17
+ loading?: boolean;
18
+ popperPlacement?: PopperPlacementType;
19
+ onChange?: (event: SyntheticChangeEvent) => void;
20
+ onInputChange?: (value: string) => void;
21
+ onScrollToBottom?: () => void;
22
+ }
23
+ export declare const Autocomplete: React.FC<AutocompleteProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ export declare const Default: Story;
3
+ export declare const Loading: Story;
4
+ declare const _default: Meta<import("@storybook/react").Args>;
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export declare const choices: {
2
+ label: string;
3
+ value: string;
4
+ }[];
@@ -0,0 +1 @@
1
+ export * from "./Autocomplete";
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"popper" | "loader" | "dropdown">;
2
+ export default useStyles;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export interface ChipProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
3
+ startAdornment?: React.ReactElement;
4
+ startAdornmentClassName?: string;
5
+ endAdornment?: React.ReactElement;
6
+ endAdornmnetClassName?: string;
7
+ }
8
+ export declare const Chip: React.ForwardRefExoticComponent<Pick<ChipProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "startAdornment" | "startAdornmentClassName" | "endAdornmnetClassName"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export interface ChipAdornmentProps {
3
+ className?: string;
4
+ inheirtCursor?: boolean;
5
+ }
6
+ export declare const ChipAdornment: React.FC<ChipAdornmentProps>;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ChipProps } from "./Chip";
3
+ export interface ChipMovableProps extends ChipProps {
4
+ }
5
+ export declare const ChipMovable: React.ForwardRefExoticComponent<Pick<ChipMovableProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "startAdornment" | "startAdornmentClassName" | "endAdornmnetClassName"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { ChipProps } from "./Chip";
3
+ export interface ChipRemovableProps extends ChipProps {
4
+ onRemove: () => void;
5
+ }
6
+ export declare const ChipRemovable: React.ForwardRefExoticComponent<Pick<ChipRemovableProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "startAdornment" | "startAdornmentClassName" | "endAdornmnetClassName" | "onRemove"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { ChipProps } from "./Chip";
3
+ export interface ChipSwatchProps extends Omit<ChipProps, "startAdornment"> {
4
+ onRemove?: () => void;
5
+ color: string;
6
+ }
7
+ export declare const ChipSwatch: React.ForwardRefExoticComponent<Pick<ChipSwatchProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "startAdornmentClassName" | "endAdornmnetClassName" | "onRemove"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,5 @@
1
+ export * from "./Chip";
2
+ export * from "./ChipAdornment";
3
+ export * from "./ChipMovable";
4
+ export * from "./ChipRemovable";
5
+ export * from "./ChipSwatch";
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface ColorSwatchProps {
3
+ color: string;
4
+ className?: string;
5
+ }
6
+ export declare const ColorSwatch: ({ color, className }: ColorSwatchProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"endAdornment" | "startAdornment" | "chip" | "swatch">;
2
+ export default useStyles;
@@ -1 +1 @@
1
- export * from './CircleIndicator';
1
+ export * from "./CircleIndicator";
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { FilterData } from "../types";
3
+ export interface FilterContentProps {
4
+ filter: FilterData;
5
+ }
6
+ export declare const AutocompleteFilterField: React.FC<FilterContentProps>;
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { FilterData } from "../types";
3
+ export interface FilterContentProps {
4
+ filter: FilterData;
5
+ }
6
+ export declare const MultipleValueAutocompleteFilterField: React.FC<FilterContentProps>;
@@ -0,0 +1,5 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ export declare const Default: Story;
3
+ export declare const WithInitialState: Story;
4
+ declare const _default: Meta<import("@storybook/react").Args>;
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ export declare const Autocomplete: Story;
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
@@ -0,0 +1,8 @@
1
+ export declare const labels: {
2
+ addButton: string;
3
+ header: string;
4
+ where: string;
5
+ and: string;
6
+ is: string;
7
+ range: string;
8
+ };
@@ -1,2 +1,2 @@
1
- declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"filter" | "bar" | "menuContent" | "menuHeader" | "menuPaper" | "filterChip" | "filterChipContainer" | "filterDelete" | "filterName" | "filterValue" | "filterRange" | "filterInputInner" | "filterConjunction" | "filterValueCheckbox" | "filterValueSelected" | "filterRangeLabel" | "filterRangeValueContainer" | "selectPaper">;
1
+ declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"filter" | "bar" | "menuContent" | "menuHeader" | "menuPaper" | "filterOptions" | "filterChip" | "filterChipContainer" | "filterDeleteContainer" | "filterDelete" | "filterName" | "filterValue" | "filterRange" | "filterInputInner" | "filterMultipleValueInputInner" | "filterConjunction" | "filterValueCheckbox" | "filterValueSelected" | "filterRangeLabel" | "filterRangeValueContainer" | "barAddBtn" | "selectPaper">;
2
2
  export default useStyles;
@@ -2,14 +2,19 @@ import { TextFieldProps } from "@material-ui/core/TextField";
2
2
  export declare enum FilterType {
3
3
  Text = 0,
4
4
  Choice = 1,
5
- Range = 2
5
+ Range = 2,
6
+ Autocomplete = 3
6
7
  }
8
+ export declare type Choice = Record<"label" | "value", string>;
7
9
  export interface FilterDetailedOptions {
8
10
  type: FilterType;
9
- choices?: Array<Record<"label" | "value", string>>;
11
+ choices?: Choice[];
10
12
  default?: string;
11
13
  multiple?: boolean;
12
14
  InputProps?: Partial<TextFieldProps>;
15
+ group?: Record<"label" | "name", string>;
16
+ displayValues?: Choice[];
17
+ onInputChange?: (value: string) => void;
13
18
  }
14
19
  export interface FilterOptions {
15
20
  name: string;
@@ -40,6 +45,7 @@ export interface FilterContextType {
40
45
  toggle: (name: string) => void;
41
46
  toggleRange: (name: string) => void;
42
47
  unregister: (name: string) => void;
48
+ swap: (previousFilterName: string, nextFilterName: string) => void;
43
49
  onChange: (name: string, value: string | string[], opts?: OnFilterChangeOpts) => void;
44
50
  }
45
51
  export declare type FilterLabels = Record<"where" | "and" | "is" | "range", string>;
@@ -1,8 +1,11 @@
1
1
  import { FilterData, FilterDetailedOptions, FilterInput, OnFilterChangeOpts } from "./types";
2
- export declare function getAvailableFilters(filterData: FilterData[]): FilterData[];
2
+ export declare function getFilterName(name: string, options: FilterDetailedOptions): string;
3
+ export declare function getAvailableFilterGroups(filterData: FilterData[]): Array<Record<"name" | "label", string>>;
4
+ export declare function getAvailableFilters(filterData: FilterData[]): Array<Record<"name" | "label", string>>;
3
5
  export declare function getActiveFilters(filterData: FilterData[]): FilterData[];
4
6
  export declare function validate(filterData: FilterData[]): void;
5
7
  export declare function register(filterData: FilterData[], name: string, label: string, initial: FilterInput[], options: FilterDetailedOptions): FilterData[];
6
8
  export declare function change(filterData: FilterData[], name: string, value: string | string[], opts?: OnFilterChangeOpts): FilterData[];
7
9
  export declare function toggle(filterData: FilterData[], name: string): FilterData[];
8
10
  export declare function toggleRange(filterData: FilterData[], name: string): FilterData[];
11
+ export declare function swap(filterData: FilterData[], previousFilterName: string, nextFilterName: string): FilterData[];
@@ -1,8 +1,10 @@
1
1
  import { IconButtonProps as MuiIconButtonProps } from "@material-ui/core/IconButton";
2
2
  import React from "react";
3
+ import { UserInteraction } from "../../types/utils";
3
4
  export declare type IconButtonProps<T extends React.ElementType = "button"> = Omit<MuiIconButtonProps<T>, "variant"> & {
4
5
  error?: boolean;
5
6
  hoverOutline?: boolean;
7
+ state?: UserInteraction;
6
8
  variant?: "primary" | "secondary";
7
9
  };
8
10
  export declare const IconButton: React.FC<IconButtonProps>;
@@ -1,6 +1,6 @@
1
1
  import type { SaleorThemeColors } from "..";
2
2
  export declare function getSecondaryButtonStyles(colors: SaleorThemeColors): {
3
- "&:hover, &.Mui-focusVisible": {
3
+ "&:hover, &.Mui-focusVisible, &$hover, &$active": {
4
4
  color: string;
5
5
  };
6
6
  "&:disabled": {
@@ -1,2 +1,2 @@
1
- declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"error" | "secondary" | "disabledError" | "hoverOutline">;
1
+ declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"error" | "active" | "hover" | "primary" | "secondary" | "hoverOutline" | "disabledError">;
2
2
  export default useStyles;
@@ -0,0 +1,26 @@
1
+ import { PopperPlacementType } from "@material-ui/core/Popper";
2
+ import { StandardTextFieldProps } from "@material-ui/core/TextField";
3
+ import { UseComboboxGetItemPropsOptions } from "downshift";
4
+ import React from "react";
5
+ import { SyntheticChangeEvent } from "../../types/utils";
6
+ import { Choice } from "../Filter";
7
+ export interface MultipleValueAutocompleteProps extends Omit<StandardTextFieldProps, "onChange"> {
8
+ children: (data: {
9
+ getItemProps: (opts: UseComboboxGetItemPropsOptions<Choice>) => any;
10
+ highlightedIndex: number;
11
+ inputValue: string;
12
+ choices: Choice[];
13
+ }) => React.ReactNode | React.ReactNodeArray;
14
+ className?: string;
15
+ enableReinitialize?: boolean;
16
+ styles?: React.CSSProperties;
17
+ choices: Choice[];
18
+ label?: string;
19
+ loading?: boolean;
20
+ popperPlacement?: PopperPlacementType;
21
+ initialValue?: Choice[];
22
+ onChange?: (event: SyntheticChangeEvent<string[]>) => void;
23
+ onInputChange?: (value: string) => void;
24
+ onScrollToBottom?: () => void;
25
+ }
26
+ export declare const MultipleValueAutocomplete: React.FC<MultipleValueAutocompleteProps>;
@@ -0,0 +1,6 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ export declare const Default: Story;
3
+ export declare const Loading: Story;
4
+ export declare const WithInitialState: Story;
5
+ declare const _default: Meta<import("@storybook/react").Args>;
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export declare const choices: {
2
+ label: string;
3
+ value: string;
4
+ }[];
@@ -0,0 +1 @@
1
+ export * from "./MultipleValueAutocomplete";
@@ -0,0 +1,2 @@
1
+ declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"input" | "icon" | "popper" | "loader" | "dropdown" | "inputContainer" | "inputContainerWithChips">;
2
+ export default useStyles;
@@ -0,0 +1,32 @@
1
+ /// <reference types="react" />
2
+ import { UseComboboxGetItemPropsOptions } from "downshift";
3
+ import { SyntheticChangeEvent } from "../../types/utils";
4
+ import { Choice } from "../Filter";
5
+ export interface UseMultipleValueAutocomplete {
6
+ choices: Choice[];
7
+ enableReinitialize?: boolean;
8
+ name?: string;
9
+ initialValue: Choice[];
10
+ onChange?: (event: SyntheticChangeEvent<string[]>) => void;
11
+ onInputChange?: (value: string) => void;
12
+ }
13
+ declare function useMultipleValueAutocomplete({ choices, enableReinitialize, initialValue, name, onChange, onInputChange, }: UseMultipleValueAutocomplete): {
14
+ anchor: import("react").MutableRefObject<HTMLDivElement | undefined>;
15
+ comboboxProps: any;
16
+ filteredChoices: Choice[];
17
+ getItemProps: (options: UseComboboxGetItemPropsOptions<Choice>) => any;
18
+ getSelectedItemProps: (options: import("downshift").UseMultipleSelectionGetSelectedItemPropsOptions<Choice>) => any;
19
+ getToggleButtonProps: (options?: import("downshift").UseComboboxGetToggleButtonPropsOptions | undefined) => any;
20
+ highlightedIndex: number;
21
+ inputProps: any;
22
+ inputRef: (node: HTMLInputElement | undefined) => void;
23
+ inputValue: string;
24
+ inputWidth: number;
25
+ isOpen: boolean;
26
+ labelProps: any;
27
+ menuProps: any;
28
+ ref: (node: HTMLDivElement | undefined) => void;
29
+ removeSelectedItem: (item: Choice) => void;
30
+ selectedItems: Choice[];
31
+ };
32
+ export default useMultipleValueAutocomplete;
@@ -7,6 +7,7 @@ export interface SavebarProps {
7
7
  state: ConfirmButtonTransitionState;
8
8
  labels: SavebarLabels;
9
9
  tooltips?: SavebarTooltips;
10
+ className?: string;
10
11
  onCancel: () => void;
11
12
  onDelete?: () => void;
12
13
  onSubmit: () => void;
@@ -1,11 +1,17 @@
1
1
  import React from "react";
2
- import { SidebarMenuItem } from "./types";
3
- export interface MenuItemProps {
2
+ import { CustomLinkComponent, SidebarMenuItem } from "./types";
3
+ export interface MenuItemCommonProps {
4
4
  activeId: string;
5
5
  isMenuShrunk: boolean;
6
6
  menuItem: SidebarMenuItem;
7
- onClick: (menuItem: SidebarMenuItem) => void;
8
7
  }
8
+ export declare type MenuItemProps = MenuItemCommonProps & ({
9
+ onClick: (menuItem: SidebarMenuItem) => void;
10
+ linkComponent?: never;
11
+ } | {
12
+ onClick?: never;
13
+ linkComponent: CustomLinkComponent;
14
+ });
9
15
  export declare const menuWidth = 210;
10
16
  export declare const shrunkMenuWidth = 72;
11
17
  export declare const MenuItem: React.FC<MenuItemProps>;
@@ -7,10 +7,18 @@ export interface SidebarMenuItem {
7
7
  iconSrc?: string;
8
8
  url?: string;
9
9
  external?: boolean;
10
+ onClick?: () => void;
10
11
  }
12
+ export declare type CustomLinkComponent = React.ForwardRefExoticComponent<{
13
+ href?: string;
14
+ onClick?: (...params: any) => void;
15
+ className?: string;
16
+ }>;
11
17
  export interface BaseSidebarProps {
12
18
  className?: string;
13
19
  menuItems: SidebarMenuItem[];
14
20
  toolbar?: React.ReactNode;
15
21
  onMenuItemClick: (menuItem: SidebarMenuItem) => void;
22
+ linkComponent?: CustomLinkComponent;
23
+ logoHref?: string;
16
24
  }
@@ -0,0 +1,12 @@
1
+ import { CustomLinkComponent, SidebarMenuItem } from "./types";
2
+ export declare const getLinkProps: (menuItem: SidebarMenuItem) => {
3
+ href: string | undefined;
4
+ target: string;
5
+ } | {
6
+ href: string;
7
+ target?: undefined;
8
+ } | {
9
+ href?: undefined;
10
+ target?: undefined;
11
+ };
12
+ export declare const getLinkComponent: (menuItem: SidebarMenuItem, customComponent?: CustomLinkComponent | undefined) => "a" | "button" | CustomLinkComponent;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- import { SidebarMenuItem } from "../Sidebar/types";
2
+ import { CustomLinkComponent, SidebarMenuItem } from "../Sidebar/types";
3
3
  export interface MenuItemBtnProps {
4
4
  menuItem: SidebarMenuItem;
5
5
  onClick: (menuItem: SidebarMenuItem) => void;
6
+ linkComponent?: CustomLinkComponent;
6
7
  }
7
8
  export declare const MenuItemBtn: React.FC<MenuItemBtnProps>;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const SwitchSelector: React.FC<{}>;
@@ -0,0 +1,4 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ export declare const Default: Story;
3
+ declare const _default: Meta<import("@storybook/react").Args>;
4
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface SwitchSelectorButtonProps {
3
+ value: string;
4
+ activeTab?: string;
5
+ onClick: () => void;
6
+ }
7
+ export declare const SwitchSelectorButton: React.FC<SwitchSelectorButtonProps>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./SwitchSelector";
2
+ export * from "./SwitchSelectorButton";
@@ -33,3 +33,6 @@ export * from "./List";
33
33
  export * from "./NavigationCard";
34
34
  export * from "./Pill";
35
35
  export * from "./CircleIndicator";
36
+ export * from "./SwitchSelector";
37
+ export * from "./Autocomplete";
38
+ export * from "./MultipleValueAutocomplete";
@@ -13,5 +13,9 @@ export interface ThemeProviderProps {
13
13
  * Saleor's Dashboard. Use with caution.
14
14
  */
15
15
  overrides?: Partial<Theme>;
16
+ /**
17
+ * Enables server side rendering.
18
+ */
19
+ ssr?: boolean;
16
20
  }
17
21
  export declare const ThemeProvider: React.FC<ThemeProviderProps>;
@@ -1,6 +1,7 @@
1
1
  import { ThemeType } from "./createSaleorTheme";
2
2
  export interface SaleorThemeContext {
3
3
  themeType: ThemeType;
4
+ ssr: boolean;
4
5
  sendThemeToExtension: () => void;
5
6
  setTheme: (theme: ThemeType) => void;
6
7
  }
@@ -0,0 +1,2 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ export declare function useTextWidth(font: string): [number, Dispatch<SetStateAction<string>>];
@@ -1,2 +1,2 @@
1
- declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"code" | "border" | "grid" | "cell" | "paragraph" | "headline" | "sectionHeader">;
1
+ declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"code" | "border" | "grid" | "cell" | "paragraph" | "headline" | "sectionHeader" | "gridCell">;
2
2
  export default useStyles;
@@ -0,0 +1,2 @@
1
+ import type { Ref } from "react";
2
+ export declare function mergeRefs<T>(...refs: Ref<T>[]): (node: T) => void;
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ export declare function useMockAutocomplete(choices: Array<Record<"label" | "value", string>>): {
3
+ search: (query: string) => NodeJS.Timeout;
4
+ results: {
5
+ score: number;
6
+ value: string;
7
+ label: string;
8
+ }[];
9
+ more: () => void;
10
+ };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.2",
2
+ "version": "0.5.0",
3
3
  "license": "CC-BY-4.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
@@ -52,12 +52,6 @@
52
52
  "react": "^16.8.0 || ^17.0.0",
53
53
  "react-helmet": "^6.1.0"
54
54
  },
55
- "husky": {
56
- "hooks": {
57
- "pre-commit": "npm run lint",
58
- "pre-push": "npm run lint"
59
- }
60
- },
61
55
  "np": {
62
56
  "yarn": false
63
57
  },
@@ -92,11 +86,12 @@
92
86
  "@material-ui/icons": "^4.11.2",
93
87
  "@material-ui/lab": "^4.0.0-alpha.58",
94
88
  "@size-limit/preset-small-lib": "^4.10.2",
95
- "@storybook/addon-essentials": "^6.2.9",
89
+ "@storybook/addon-essentials": "^6.4.22",
96
90
  "@storybook/addon-info": "^5.3.21",
97
- "@storybook/addon-links": "^6.2.9",
98
- "@storybook/addons": "^6.2.9",
99
- "@storybook/react": "^6.2.9",
91
+ "@storybook/addon-links": "^6.4.22",
92
+ "@storybook/addons": "^6.4.22",
93
+ "@storybook/react": "^6.4.22",
94
+ "@types/fuzzaldrin": "^2.1.4",
100
95
  "@types/jest": "^27.0.2",
101
96
  "@types/lodash": "^4.14.170",
102
97
  "@types/lodash-es": "^4.17.5",
@@ -112,8 +107,10 @@
112
107
  "esbuild-jest": "^0.5.0",
113
108
  "eslint": "^7.32.0",
114
109
  "eslint-plugin-simple-import-sort": "^5.0.3",
110
+ "eslint-plugin-storybook": "^0.5.10",
115
111
  "faker": "^5.5.3",
116
- "husky": "^6.0.0",
112
+ "husky": "^7.0.0",
113
+ "fuzzaldrin": "^2.1.0",
117
114
  "hygen": "^6.1.0",
118
115
  "jest": "^27.2.4",
119
116
  "jest-file": "^1.0.0",
@@ -123,13 +120,14 @@
123
120
  "react-dom": "^16.8.0 || ^17.0.0",
124
121
  "react-is": "^17.0.2",
125
122
  "size-limit": "^4.10.2",
126
- "storybook-dark-mode": "^1.0.8",
123
+ "storybook-dark-mode": "^1.0.9",
127
124
  "tslib": "^2.3.1",
128
125
  "typescript": "^4.2.4",
129
126
  "yargs": "^17.2.1"
130
127
  },
131
128
  "dependencies": {
132
129
  "clsx": "^1.1.1",
130
+ "downshift": "^6.1.7",
133
131
  "lodash": "^4.17.21",
134
132
  "lodash-es": "^4.17.21",
135
133
  "react-inlinesvg": "^2.3.0"