@saleor/macaw-ui 0.4.0 → 0.5.2
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.
- package/dist/ActionBar/ActionBar.d.ts +8 -0
- package/dist/ActionBar/ActionBar.stories.d.ts +4 -0
- package/dist/ActionBar/context.d.ts +9 -0
- package/dist/ActionBar/index.d.ts +2 -0
- package/dist/ActionBar/styles.d.ts +2 -0
- package/dist/Alert/Alert.d.ts +8 -0
- package/dist/Alert/Alert.stories.d.ts +12 -0
- package/dist/Alert/AlertBase.d.ts +8 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/styles.d.ts +2 -0
- package/dist/Backlink/Backlink.d.ts +8 -0
- package/dist/Backlink/Backlink.stories.d.ts +5 -0
- package/dist/Backlink/context.d.ts +5 -0
- package/dist/Backlink/index.d.ts +2 -0
- package/dist/Backlink/styles.d.ts +2 -0
- package/dist/BaseList/BaseList.d.ts +26 -0
- package/dist/BaseList/context.d.ts +7 -0
- package/dist/BaseList/index.d.ts +1 -0
- package/dist/BaseList/styles.d.ts +5 -0
- package/dist/Button/Button.d.ts +16 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/styles.d.ts +2 -0
- package/dist/ConfirmButton/ConfirmButton.d.ts +11 -0
- package/dist/ConfirmButton/ConfirmButton.stories.d.ts +8 -0
- package/dist/ConfirmButton/index.d.ts +1 -0
- package/dist/ConfirmButton/styles.d.ts +2 -0
- package/dist/DialogHeader/DialogHeader.d.ts +6 -0
- package/dist/DialogHeader/index.d.ts +1 -0
- package/dist/DialogHeader/styles.d.ts +1 -0
- package/dist/DialogTable/DialogTable.d.ts +6 -0
- package/dist/DialogTable/index.d.ts +1 -0
- package/dist/DialogTable/styles.d.ts +1 -0
- package/dist/Filter/Filter.d.ts +10 -0
- package/dist/Filter/Filter.stories.d.ts +5 -0
- package/dist/Filter/FilterBar.d.ts +11 -0
- package/dist/Filter/FilterContent.d.ts +7 -0
- package/dist/Filter/FilterField/MultipleSelectFilterField.d.ts +6 -0
- package/dist/Filter/FilterField/RangeFilterField.d.ts +7 -0
- package/dist/Filter/FilterField/SelectFilterField.d.ts +6 -0
- package/dist/Filter/FilterField/TextFilterField.d.ts +6 -0
- package/dist/Filter/FilterMenu.d.ts +9 -0
- package/dist/Filter/context.d.ts +4 -0
- package/dist/Filter/index.d.ts +4 -0
- package/dist/Filter/styles.d.ts +2 -0
- package/dist/Filter/types.d.ts +49 -0
- package/dist/Filter/utils.d.ts +8 -0
- package/dist/IconButton/IconButton.d.ts +8 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/IconButton/partials.d.ts +14 -0
- package/dist/IconButton/styles.d.ts +2 -0
- package/dist/LayoutButton/LayoutButton.d.ts +7 -0
- package/dist/LayoutButton/index.d.ts +1 -0
- package/dist/LayoutButton/styles.d.ts +2 -0
- package/dist/List/List.d.ts +13 -0
- package/dist/List/List.stories.d.ts +5 -0
- package/dist/List/context.d.ts +8 -0
- package/dist/List/index.d.ts +1 -0
- package/dist/List/styles.d.ts +1 -0
- package/dist/Notification/Notification.d.ts +3 -0
- package/dist/Notification/Notification.stories.d.ts +10 -0
- package/dist/Notification/index.d.ts +2 -0
- package/dist/Notification/styles.d.ts +2 -0
- package/dist/Notification/types.d.ts +16 -0
- package/dist/OffsettedList/OffsettedList.d.ts +12 -0
- package/dist/OffsettedList/OffsettedList.stories.d.ts +5 -0
- package/dist/OffsettedList/index.d.ts +1 -0
- package/dist/OffsettedList/styles.d.ts +2 -0
- package/dist/PageTabs/PageTab.d.ts +3 -0
- package/dist/PageTabs/PageTab.stories.d.ts +4 -0
- package/dist/PageTabs/PageTabPanel.d.ts +4 -0
- package/dist/PageTabs/PageTabs.d.ts +5 -0
- package/dist/PageTabs/index.d.ts +3 -0
- package/dist/PageTabs/styles.d.ts +2 -0
- package/dist/Pagination/Pagination.d.ts +10 -0
- package/dist/Pagination/PaginationActions.d.ts +11 -0
- package/dist/Pagination/PaginationRowNumberSelect.d.ts +11 -0
- package/dist/Pagination/TablePagination.d.ts +6 -0
- package/dist/Pagination/index.d.ts +4 -0
- package/dist/Pagination/styles.d.ts +2 -0
- package/dist/PillLink/PillLink.d.ts +15 -0
- package/dist/PillLink/index.d.ts +1 -0
- package/dist/PillLink/styles.d.ts +2 -0
- package/dist/ResponsiveTable/ResponsiveTable.d.ts +8 -0
- package/dist/ResponsiveTable/index.d.ts +1 -0
- package/dist/ResponsiveTable/styles.d.ts +2 -0
- package/dist/Savebar/ButtonTooltipDecorator.d.ts +6 -0
- package/dist/Savebar/Savebar.d.ts +14 -0
- package/dist/Savebar/Savebar.stories.d.ts +6 -0
- package/dist/Savebar/index.d.ts +1 -0
- package/dist/Savebar/styles.d.ts +2 -0
- package/dist/ScrollShadow/ScrollShadow.d.ts +6 -0
- package/dist/ScrollShadow/index.d.ts +1 -0
- package/dist/ScrollShadow/styles.d.ts +1 -0
- package/dist/Sidebar/ExpandButton.d.ts +6 -0
- package/dist/Sidebar/MenuItem.d.ts +11 -0
- package/dist/Sidebar/Sidebar.d.ts +6 -0
- package/dist/Sidebar/Sidebar.stories.d.ts +6 -0
- package/dist/Sidebar/fixtures.d.ts +2 -0
- package/dist/Sidebar/index.d.ts +4 -0
- package/dist/Sidebar/types.d.ts +16 -0
- package/dist/SidebarDrawer/MenuItemBtn.d.ts +7 -0
- package/dist/SidebarDrawer/SidebarDrawer.d.ts +4 -0
- package/dist/SidebarDrawer/SidebarDrawer.stories.d.ts +4 -0
- package/dist/SidebarDrawer/index.d.ts +2 -0
- package/dist/SidebarDrawer/styles.d.ts +2 -0
- package/dist/SquareButton/SquareButton.d.ts +3 -0
- package/dist/SquareButton/SquareButton.stories.d.ts +5 -0
- package/dist/SquareButton/index.d.ts +1 -0
- package/dist/StatusChip/StatusChip.d.ts +3 -0
- package/dist/StatusChip/StatusChip.stories.d.ts +8 -0
- package/dist/StatusChip/index.d.ts +2 -0
- package/dist/StatusChip/styles.d.ts +3 -0
- package/dist/StatusChip/types.d.ts +8 -0
- package/dist/Tooltip/Tooltip.d.ts +6 -0
- package/dist/Tooltip/Tooltip.stories.d.ts +7 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/styles.d.ts +3 -0
- package/dist/UserChipMenu/UserChipMenu.d.ts +9 -0
- package/dist/UserChipMenu/UserChipMenu.stories.d.ts +6 -0
- package/dist/UserChipMenu/UserChipMenuItem.d.ts +6 -0
- package/dist/UserChipMenu/context.d.ts +4 -0
- package/dist/UserChipMenu/index.d.ts +2 -0
- package/dist/UserChipMenu/styles.d.ts +2 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +3 -3
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/sendMessage.d.ts +3 -0
- package/dist/extensions/types.d.ts +22 -0
- package/dist/extensions/useExtensionMessage.d.ts +2 -0
- package/dist/icons/ArrowDropdownIcon.d.ts +2 -0
- package/dist/icons/ArrowRightIcon.d.ts +1 -0
- package/dist/icons/CheckboxCheckedIcon.d.ts +1 -0
- package/dist/icons/CheckboxIcon.d.ts +1 -0
- package/dist/icons/CheckboxIndeterminateIcon.d.ts +1 -0
- package/dist/icons/CloseIcon.d.ts +1 -0
- package/dist/icons/CompleteIcon.d.ts +2 -0
- package/dist/icons/DeleteIcon.d.ts +1 -0
- package/dist/icons/EditIcon.d.ts +1 -0
- package/dist/icons/FilteringIcon.d.ts +1 -0
- package/dist/icons/ImageIcon.d.ts +1 -0
- package/dist/icons/InfoIcon.d.ts +2 -0
- package/dist/icons/Logo.d.ts +2 -0
- package/dist/icons/LogoLight.d.ts +2 -0
- package/dist/icons/MoreIcon.d.ts +1 -0
- package/dist/icons/NavigatorIcon.d.ts +1 -0
- package/dist/icons/NotAllowedIcon.d.ts +2 -0
- package/dist/icons/NotAllowedInvertedIcon.d.ts +2 -0
- package/dist/icons/PlusIcon.d.ts +1 -0
- package/dist/icons/RadioCheckedIcon.d.ts +1 -0
- package/dist/icons/RadioIcon.d.ts +1 -0
- package/dist/icons/SearchIcon.d.ts +1 -0
- package/dist/icons/WarningIcon.d.ts +2 -0
- package/dist/icons/index.d.ts +18 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/localStorageKeys.d.ts +4 -0
- package/dist/mjs/index.js +5 -0
- package/dist/mjs/index.js.map +7 -0
- package/dist/theme/Baseline.d.ts +2 -0
- package/dist/theme/ThemeProvider.d.ts +17 -0
- package/dist/theme/context.d.ts +3 -0
- package/dist/theme/createSaleorTheme/createSaleorTheme.d.ts +3 -0
- package/dist/theme/createSaleorTheme/index.d.ts +2 -0
- package/dist/theme/createSaleorTheme/overrides/buttons.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/controls.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/index.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/inputs.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/tables.d.ts +3 -0
- package/dist/theme/createSaleorTheme/palette.d.ts +2 -0
- package/dist/theme/createSaleorTheme/shadows.d.ts +2 -0
- package/dist/theme/createSaleorTheme/types.d.ts +51 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/styles.d.ts +5 -0
- package/dist/theme/themes.d.ts +3 -0
- package/dist/theme/types.d.ts +6 -0
- package/dist/theme/utils.d.ts +1 -0
- package/dist/theme/utils.test.d.ts +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/useElementScroll.d.ts +12 -0
- package/dist/tools/useLocalStorage.d.ts +5 -0
- package/dist/tools/useWindowScroll.d.ts +4 -0
- package/dist/types/Autocomplete/Autocomplete.d.ts +23 -0
- package/dist/types/Autocomplete/Autocomplete.stories.d.ts +5 -0
- package/dist/types/Autocomplete/fixtures.d.ts +4 -0
- package/dist/types/Autocomplete/index.d.ts +1 -0
- package/dist/types/Autocomplete/styles.d.ts +2 -0
- package/dist/types/Backlink/Backlink.d.ts +6 -4
- package/dist/types/Filter/FilterField/AutocompleteFilterField.d.ts +6 -0
- package/dist/types/Filter/FilterField/MultipleValueAutocompleteFilterField.d.ts +6 -0
- package/dist/types/Filter/stories/Filter.stories.d.ts +5 -0
- package/dist/types/Filter/stories/FilterInteractive.stories.d.ts +4 -0
- package/dist/types/Filter/stories/labels.d.ts +8 -0
- package/dist/types/Filter/styles.d.ts +1 -1
- package/dist/types/Filter/types.d.ts +8 -2
- package/dist/types/Filter/utils.d.ts +4 -1
- package/dist/types/IconButton/IconButton.d.ts +44 -2
- package/dist/types/LayoutButton/LayoutButton.d.ts +29 -2
- package/dist/types/MultipleValueAutocomplete/MultipleValueAutocomplete.d.ts +26 -0
- package/dist/types/MultipleValueAutocomplete/MultipleValueAutocomplete.stories.d.ts +6 -0
- package/dist/types/MultipleValueAutocomplete/fixtures.d.ts +4 -0
- package/dist/types/MultipleValueAutocomplete/index.d.ts +1 -0
- package/dist/types/MultipleValueAutocomplete/styles.d.ts +2 -0
- package/dist/types/MultipleValueAutocomplete/useMultipleValueAutocomplete.d.ts +32 -0
- package/dist/types/StatusChip/styles.d.ts +3 -0
- package/dist/types/SwitchSelector/SwitchSelector.d.ts +2 -0
- package/dist/types/SwitchSelector/SwitchSelector.stories.d.ts +4 -0
- package/dist/types/SwitchSelector/SwitchSelectorButton.d.ts +8 -0
- package/dist/types/SwitchSelector/index.d.ts +2 -0
- package/dist/types/consts.d.ts +4 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/tools/useTextWidth.d.ts +2 -0
- package/dist/types/utils/mergeRefs.d.ts +2 -0
- package/dist/types/utils/useMockAutocomplete.d.ts +10 -0
- package/dist/utils/Decorator.d.ts +4 -0
- package/dist/utils/useListStory.d.ts +21 -0
- package/package.json +10 -6
- package/src/Autocomplete/Autocomplete.stories.tsx +43 -0
- package/src/Autocomplete/Autocomplete.tsx +188 -0
- package/src/Autocomplete/fixtures.ts +122 -0
- package/src/Autocomplete/index.ts +1 -0
- package/src/Autocomplete/styles.ts +22 -0
- package/src/Backlink/Backlink.tsx +7 -7
- package/src/Backlink/styles.ts +1 -1
- package/src/Chip/styles.ts +2 -1
- package/src/Filter/Filter.tsx +88 -44
- package/src/Filter/FilterBar.tsx +15 -9
- package/src/Filter/FilterContent.tsx +8 -1
- package/src/Filter/FilterField/AutocompleteFilterField.tsx +61 -0
- package/src/Filter/FilterField/MultipleSelectFilterField.tsx +6 -2
- package/src/Filter/FilterField/MultipleValueAutocompleteFilterField.tsx +60 -0
- package/src/Filter/context.tsx +1 -1
- package/src/Filter/{Filter.stories.tsx → stories/Filter.stories.tsx} +47 -13
- package/src/Filter/stories/FilterInteractive.stories.tsx +97 -0
- package/src/Filter/stories/labels.ts +8 -0
- package/src/Filter/styles.ts +37 -6
- package/src/Filter/types.ts +8 -1
- package/src/Filter/utils.ts +71 -5
- package/src/IconButton/IconButton.tsx +29 -7
- package/src/LayoutButton/LayoutButton.tsx +39 -23
- package/src/MultipleValueAutocomplete/MultipleValueAutocomplete.stories.tsx +76 -0
- package/src/MultipleValueAutocomplete/MultipleValueAutocomplete.tsx +185 -0
- package/src/MultipleValueAutocomplete/fixtures.ts +122 -0
- package/src/MultipleValueAutocomplete/index.ts +1 -0
- package/src/MultipleValueAutocomplete/styles.ts +41 -0
- package/src/MultipleValueAutocomplete/useMultipleValueAutocomplete.ts +172 -0
- package/src/SwitchSelector/SwitchSelector.stories.tsx +63 -0
- package/src/SwitchSelector/SwitchSelector.tsx +20 -0
- package/src/SwitchSelector/SwitchSelectorButton.tsx +60 -0
- package/src/SwitchSelector/index.ts +2 -0
- package/src/consts.ts +4 -0
- package/src/index.tsx +3 -0
- package/src/theme/createSaleorTheme/createSaleorTheme.tsx +1 -1
- package/src/tools/useTextWidth.ts +20 -0
- package/src/utils/mergeRefs.ts +14 -0
- package/src/utils/useMockAutocomplete.ts +37 -0
- package/dist/types/Chip/ColorSwatch.d.ts +0 -6
- package/dist/types/Chip/common/ChipMovable.d.ts +0 -5
- package/dist/types/Chip/common/ChipRemovable.d.ts +0 -6
- package/dist/types/Chip/common/ChipSwatch.d.ts +0 -7
- package/dist/types/Chip/common/index.d.ts +0 -3
- package/src/Chip/.DS_Store +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Theme } from "@material-ui/core/styles";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Themes, ThemeType } from "./createSaleorTheme";
|
|
4
|
+
export interface ThemeProviderProps {
|
|
5
|
+
defaultTheme?: ThemeType;
|
|
6
|
+
/**
|
|
7
|
+
* Passing an object here will result in losing visual consistency with
|
|
8
|
+
* Saleor's Dashboard. Use with caution.
|
|
9
|
+
*/
|
|
10
|
+
palettes?: Partial<Themes>;
|
|
11
|
+
/**
|
|
12
|
+
* Passing an object here will result in losing visual consistency with
|
|
13
|
+
* Saleor's Dashboard. Use with caution.
|
|
14
|
+
*/
|
|
15
|
+
overrides?: Partial<Theme>;
|
|
16
|
+
}
|
|
17
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Theme, ThemeOptions } from "@material-ui/core/styles";
|
|
2
|
+
export declare type ThemeType = "light" | "dark";
|
|
3
|
+
export declare type SaleorThemeColors = Record<"primary" | "secondary" | "error" | "paperBorder" | "autofill" | "success" | "disabled", string> & {
|
|
4
|
+
highlightInactive: Record<"default", string>;
|
|
5
|
+
} & {
|
|
6
|
+
background: Record<"default" | "paper", string>;
|
|
7
|
+
} & {
|
|
8
|
+
checkbox: Record<"default", string>;
|
|
9
|
+
} & {
|
|
10
|
+
divider: string;
|
|
11
|
+
} & {
|
|
12
|
+
font: Record<"default" | "gray" | "button" | "textButton" | "textDisabled", string>;
|
|
13
|
+
} & {
|
|
14
|
+
gray: Record<"default" | "disabled", string>;
|
|
15
|
+
} & {
|
|
16
|
+
alert: AlertColors;
|
|
17
|
+
theme: ThemeType;
|
|
18
|
+
fail: Record<"dark" | "mid" | "light", string>;
|
|
19
|
+
main: Record<1 | 2 | 3 | 4, string>;
|
|
20
|
+
active: Record<1 | 2 | 3 | 4 | 5, string>;
|
|
21
|
+
errorAction: Record<1 | 2 | 3 | 4 | 5, string>;
|
|
22
|
+
};
|
|
23
|
+
export declare type AlertPalette = Record<"success" | "error" | "warning" | "info", string>;
|
|
24
|
+
export declare type AlertColors = Record<"paper" | "icon", AlertPalette>;
|
|
25
|
+
interface ExtraPalette {
|
|
26
|
+
alert: AlertColors;
|
|
27
|
+
saleor: SaleorThemeColors;
|
|
28
|
+
textHighlighted: {
|
|
29
|
+
active: string;
|
|
30
|
+
inactive: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
declare type ExtraPaletteOptions = Partial<ExtraPalette>;
|
|
34
|
+
export declare type SaleorPalette = Theme["palette"] & ExtraPalette;
|
|
35
|
+
export declare type SaleorPaletteOptions = ThemeOptions["palette"] & ExtraPaletteOptions;
|
|
36
|
+
export interface SaleorSpacing {
|
|
37
|
+
(): string;
|
|
38
|
+
(value: number): string;
|
|
39
|
+
(topBottom: number, rightLeft: number): string;
|
|
40
|
+
(top: number, rightLeft: number, bottom: number): string;
|
|
41
|
+
(top: number, right: number, bottom: number, left: number): string;
|
|
42
|
+
}
|
|
43
|
+
export interface SaleorTheme extends Omit<Theme, "spacing"> {
|
|
44
|
+
palette: SaleorPalette;
|
|
45
|
+
spacing: SaleorSpacing;
|
|
46
|
+
}
|
|
47
|
+
export interface SaleorThemeOptions extends ThemeOptions {
|
|
48
|
+
palette: SaleorPaletteOptions;
|
|
49
|
+
}
|
|
50
|
+
export declare type Themes = Record<ThemeType, SaleorThemeColors>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClassNameMap, Styles, WithStylesOptions } from "@material-ui/styles/withStyles";
|
|
2
|
+
import { SaleorTheme } from "./createSaleorTheme/types";
|
|
3
|
+
import type { SaleorThemeContext } from "./types";
|
|
4
|
+
export declare function makeStyles<Props extends Record<string, any> = {}, ClassKey extends string = string>(styles: Styles<SaleorTheme, Props, ClassKey>, options?: Omit<WithStylesOptions<SaleorTheme>, "withTheme">): keyof Props extends never ? (props?: any) => ClassNameMap<ClassKey> : (props: Props) => ClassNameMap<ClassKey>;
|
|
5
|
+
export declare function useTheme(): SaleorTheme & SaleorThemeContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function changeColorMeta(color: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type Position = Record<"x" | "y", number>;
|
|
3
|
+
export declare function isScrolledToBottom(anchor: HTMLElement, position: Position, offset?: number): boolean | undefined;
|
|
4
|
+
export declare function isScrolledToTop(anchor: HTMLElement, position: Position, offset?: number): boolean | undefined;
|
|
5
|
+
export interface UseElementScrollOpts<T extends HTMLElement> {
|
|
6
|
+
anchor: T | null;
|
|
7
|
+
position: Position | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface UseElementScroll<T extends HTMLElement> extends UseElementScrollOpts<T> {
|
|
10
|
+
setAnchor: React.Dispatch<T | null>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useElementScroll<T extends HTMLElement>(): UseElementScroll<T>;
|
|
@@ -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 @@
|
|
|
1
|
+
export * from "./Autocomplete";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { LayoutButtonProps } from "../LayoutButton";
|
|
3
|
-
export
|
|
3
|
+
export declare type BacklinkProps<T extends React.ElementType> = LayoutButtonProps<T> & {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
};
|
|
7
|
+
export declare const Backlink: {
|
|
8
|
+
<T extends React.ElementType<any>>({ children, disabled, onClick, ...props }: BacklinkProps<T>): JSX.Element | null;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -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?:
|
|
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
|
|
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,10 +1,52 @@
|
|
|
1
|
+
import { IconButtonTypeMap as MuiIconButtonTypeMap } from "@material-ui/core/IconButton";
|
|
1
2
|
import { IconButtonProps as MuiIconButtonProps } from "@material-ui/core/IconButton";
|
|
3
|
+
import { OverrideProps } from "@material-ui/core/OverridableComponent";
|
|
2
4
|
import React from "react";
|
|
3
5
|
import { UserInteraction } from "../../types/utils";
|
|
4
|
-
|
|
6
|
+
interface IconButtonInnerProps {
|
|
5
7
|
error?: boolean;
|
|
6
8
|
hoverOutline?: boolean;
|
|
7
9
|
state?: UserInteraction;
|
|
8
10
|
variant?: "primary" | "secondary";
|
|
11
|
+
}
|
|
12
|
+
export interface IconButtonTypeMap<P = {}, D extends React.ElementType = "button"> {
|
|
13
|
+
props: Omit<MuiIconButtonTypeMap<P, D>["props"], "variant"> & IconButtonInnerProps & {
|
|
14
|
+
href?: string;
|
|
15
|
+
} & OverrideProps<MuiIconButtonTypeMap<P, D>, "a">;
|
|
16
|
+
defaultComponent: D;
|
|
17
|
+
classKey: never;
|
|
18
|
+
}
|
|
19
|
+
export declare type IconButtonProps<T extends React.ElementType = "button"> = MuiIconButtonProps<T, {
|
|
20
|
+
component?: T;
|
|
21
|
+
}> & IconButtonInnerProps & {
|
|
22
|
+
href?: string;
|
|
9
23
|
};
|
|
10
|
-
|
|
24
|
+
declare const _IconButton: React.FC<IconButtonProps>;
|
|
25
|
+
export declare const IconButton: <T extends React.ElementType<any> = "button">(props: {
|
|
26
|
+
component?: T | undefined;
|
|
27
|
+
} & {
|
|
28
|
+
color?: import("@material-ui/core").PropTypes.Color | undefined;
|
|
29
|
+
disableFocusRipple?: boolean | undefined;
|
|
30
|
+
edge?: false | "end" | "start" | undefined;
|
|
31
|
+
size?: "small" | "medium" | undefined;
|
|
32
|
+
} & {
|
|
33
|
+
action?: React.Ref<import("@material-ui/core/ButtonBase").ButtonBaseActions> | undefined;
|
|
34
|
+
buttonRef?: React.Ref<unknown> | undefined;
|
|
35
|
+
centerRipple?: boolean | undefined;
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
disabled?: boolean | undefined;
|
|
38
|
+
disableRipple?: boolean | undefined;
|
|
39
|
+
disableTouchRipple?: boolean | undefined;
|
|
40
|
+
focusRipple?: boolean | undefined;
|
|
41
|
+
focusVisibleClassName?: string | undefined;
|
|
42
|
+
onFocusVisible?: React.FocusEventHandler<any> | undefined;
|
|
43
|
+
tabIndex?: string | number | undefined;
|
|
44
|
+
TouchRippleProps?: Partial<import("@material-ui/core/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
45
|
+
} & import("@material-ui/core/OverridableComponent").CommonProps<MuiIconButtonTypeMap<{
|
|
46
|
+
component?: T | undefined;
|
|
47
|
+
}, T>> & import("@material-ui/types").Omit<React.ComponentPropsWithRef<T>, keyof import("@material-ui/core/OverridableComponent").CommonProps<M>> & IconButtonInnerProps & {
|
|
48
|
+
href?: string | undefined;
|
|
49
|
+
} & {
|
|
50
|
+
ref?: React.ForwardedRef<T> | undefined;
|
|
51
|
+
}) => ReturnType<typeof _IconButton>;
|
|
52
|
+
export {};
|
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import type { ButtonBaseProps } from "@material-ui/core/ButtonBase";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { UserInteraction } from "../../types/utils";
|
|
4
|
-
export declare type LayoutButtonProps<T extends React.ElementType
|
|
4
|
+
export declare type LayoutButtonProps<T extends React.ElementType> = ButtonBaseProps<T, {
|
|
5
|
+
component?: T;
|
|
6
|
+
}> & {
|
|
5
7
|
state?: UserInteraction;
|
|
6
8
|
};
|
|
7
|
-
export declare const
|
|
9
|
+
export declare const LayoutButtonInner: {
|
|
10
|
+
<T extends React.ElementType<any> = "button">({ className, children, state, component, ...rest }: LayoutButtonProps<T>, ref: React.ForwardedRef<HTMLButtonElement>): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const LayoutButton: <T extends React.ElementType<any>>(props: {
|
|
14
|
+
component?: T | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
action?: React.Ref<import("@material-ui/core/ButtonBase").ButtonBaseActions> | undefined;
|
|
17
|
+
buttonRef?: React.Ref<unknown> | undefined;
|
|
18
|
+
centerRipple?: boolean | undefined;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
disabled?: boolean | undefined;
|
|
21
|
+
disableRipple?: boolean | undefined;
|
|
22
|
+
disableTouchRipple?: boolean | undefined;
|
|
23
|
+
focusRipple?: boolean | undefined;
|
|
24
|
+
focusVisibleClassName?: string | undefined;
|
|
25
|
+
onFocusVisible?: React.FocusEventHandler<any> | undefined;
|
|
26
|
+
tabIndex?: string | number | undefined;
|
|
27
|
+
TouchRippleProps?: Partial<import("@material-ui/core/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
28
|
+
} & import("@material-ui/core/OverridableComponent").CommonProps<import("@material-ui/core/ButtonBase").ButtonBaseTypeMap<{
|
|
29
|
+
component?: T | undefined;
|
|
30
|
+
}, T>> & import("@material-ui/types").Omit<React.ComponentPropsWithRef<T>, keyof import("@material-ui/core/OverridableComponent").CommonProps<M>> & {
|
|
31
|
+
state?: UserInteraction | undefined;
|
|
32
|
+
} & {
|
|
33
|
+
ref?: React.ForwardedRef<unknown> | undefined;
|
|
34
|
+
}) => ReturnType<typeof LayoutButtonInner>;
|
|
@@ -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 @@
|
|
|
1
|
+
export * from "./MultipleValueAutocomplete";
|
|
@@ -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;
|
package/dist/types/consts.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface TableDataRow {
|
|
3
|
+
name: string;
|
|
4
|
+
calories: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function useListStory(initialRowsPerPage?: number): {
|
|
7
|
+
data: TableDataRow[];
|
|
8
|
+
pageData: TableDataRow[];
|
|
9
|
+
page: number;
|
|
10
|
+
nextPage: () => void;
|
|
11
|
+
previousPage: () => void;
|
|
12
|
+
hasNextPage: boolean;
|
|
13
|
+
hasPreviousPage: boolean;
|
|
14
|
+
rowsPerPage: number;
|
|
15
|
+
setRowsPerPage: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
16
|
+
selected: string[];
|
|
17
|
+
isRowSelected: (name: string) => boolean;
|
|
18
|
+
toggleRow: (name: string) => void;
|
|
19
|
+
toggleAll: () => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|