@overmap-ai/blocks 1.0.6 → 1.0.7
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/README.md +3 -3
- package/dist/BaseMenuGroups/BaseItemGroup/BaseItemGroup.d.ts +3 -0
- package/dist/BaseMenuGroups/BaseItemGroup/index.d.ts +2 -0
- package/dist/BaseMenuGroups/BaseItemGroup/typings.d.ts +11 -0
- package/dist/BaseMenuGroups/BaseMenuComponents.d.ts +11 -0
- package/dist/BaseMenuGroups/BaseMultiSelectGroup/BaseMultiSelectGroup.d.ts +3 -0
- package/dist/BaseMenuGroups/BaseMultiSelectGroup/index.d.ts +2 -0
- package/dist/BaseMenuGroups/BaseMultiSelectGroup/typings.d.ts +16 -0
- package/dist/BaseMenuGroups/BaseSelectGroup/BaseSelectGroup.d.ts +3 -0
- package/dist/BaseMenuGroups/BaseSelectGroup/index.d.ts +2 -0
- package/dist/BaseMenuGroups/BaseSelectGroup/typings.d.ts +16 -0
- package/dist/BaseMenuGroups/BaseSubMenuGroup/BaseSubMenuGroup.d.ts +3 -0
- package/dist/BaseMenuGroups/BaseSubMenuGroup/index.d.ts +2 -0
- package/dist/BaseMenuGroups/BaseSubMenuGroup/typings.d.ts +14 -0
- package/dist/BaseMenuGroups/index.d.ts +5 -0
- package/dist/BaseMenuGroups/typings.d.ts +37 -0
- package/dist/BaseMenuGroups/utils.d.ts +5 -0
- package/dist/Dialogs/Dialog/index.d.ts +1 -0
- package/dist/Dialogs/Dialog/utils.d.ts +7 -0
- package/dist/DropdownItemMenu/DropdownItemMenu.d.ts +9 -0
- package/dist/DropdownItemMenu/index.d.ts +2 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts +5 -17
- package/dist/DropdownMenu/DropdownMenuGroups.d.ts +18 -0
- package/dist/DropdownMenu/index.d.ts +2 -0
- package/dist/DropdownMultiSelect/DropdownMultiSelect.d.ts +6 -0
- package/dist/DropdownMultiSelect/index.d.ts +2 -0
- package/dist/DropdownSelect/DropdownSelect.d.ts +5 -57
- package/dist/DropdownSelect/index.d.ts +1 -1
- package/dist/Separator/typings.d.ts +2 -1
- package/dist/blocks.js +522 -251
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +515 -247
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/style.css +59 -59
- package/dist/utils.d.ts +12 -1
- package/package.json +102 -98
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# overmap-ai blocks
|
|
2
|
-
|
|
3
|
-
Contains basic components used by overmap-ai libraries.
|
|
1
|
+
# overmap-ai blocks
|
|
2
|
+
|
|
3
|
+
Contains basic components used by overmap-ai libraries.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { MenuGroupProps, MenuItemProps } from "@radix-ui/react-menu";
|
|
3
|
+
import { BaseMenuItemProps, BaseMenuGroupProps, TextFilterProps } from "../typings.ts";
|
|
4
|
+
export type BaseItemProps = BaseMenuItemProps & Omit<MenuItemProps, "asChild" | "content"> & {
|
|
5
|
+
shortcut?: string[];
|
|
6
|
+
};
|
|
7
|
+
export type BaseItemGroupProps = BaseMenuGroupProps<BaseItemProps> & Omit<MenuGroupProps, "asChild"> & TextFilterProps;
|
|
8
|
+
export interface BaseItemGroupElementProps {
|
|
9
|
+
groupElement: FC<MenuGroupProps>;
|
|
10
|
+
itemElement: FC<MenuItemProps>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
import { InputProps } from "..";
|
|
3
|
+
export interface BaseMenuItem extends PropsWithChildren {
|
|
4
|
+
rightSlot?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const BaseMenuItem: FC<BaseMenuItem>;
|
|
7
|
+
export interface BaseMenuInputProps extends Omit<InputProps, "showInputLength"> {
|
|
8
|
+
}
|
|
9
|
+
export declare const BaseMenuInput: FC<BaseMenuInputProps>;
|
|
10
|
+
/** Separator component used for Base Menus */
|
|
11
|
+
export declare const BaseMenuSeparator: FC;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MenuCheckboxItemProps, MenuGroupProps, MenuItemIndicatorProps } from "@radix-ui/react-menu";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
import { BaseMenuItemProps, BaseMenuGroupProps, TextFilterProps } from "../typings.ts";
|
|
4
|
+
export type BaseMultiSelectItemProps = BaseMenuItemProps & Omit<MenuCheckboxItemProps, "asChild" | "content" | "checked" | "onCheckedChange"> & {
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export type BaseMultiSelectGroupProps = BaseMenuGroupProps<BaseMultiSelectItemProps> & Omit<MenuGroupProps, "asChild"> & {
|
|
8
|
+
selectedIndicator?: ReactNode;
|
|
9
|
+
values: string[];
|
|
10
|
+
onValueChange: (values: string[]) => void;
|
|
11
|
+
} & TextFilterProps;
|
|
12
|
+
export interface BaseMultiSelectGroupElementProps {
|
|
13
|
+
groupElement: FC<MenuGroupProps>;
|
|
14
|
+
itemElement: FC<MenuCheckboxItemProps>;
|
|
15
|
+
itemIndicatorElement: FC<MenuItemIndicatorProps>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { MenuCheckboxItemProps, MenuGroupProps, MenuItemIndicatorProps } from "@radix-ui/react-menu";
|
|
3
|
+
import { BaseMenuItemProps, BaseMenuGroupProps, TextFilterProps } from "../typings.ts";
|
|
4
|
+
export type BaseSelectItemProps = BaseMenuItemProps & Omit<MenuCheckboxItemProps, "asChild" | "content"> & {
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export type BaseSelectGroupProps = BaseMenuGroupProps<BaseSelectItemProps> & Omit<MenuGroupProps, "asChild"> & TextFilterProps & {
|
|
8
|
+
value: string | null;
|
|
9
|
+
onValueChange: (value: string | null) => void;
|
|
10
|
+
selectedIndicator?: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export interface BaseSelectGroupElementProps {
|
|
13
|
+
groupElement: FC<MenuGroupProps>;
|
|
14
|
+
itemElement: FC<MenuCheckboxItemProps>;
|
|
15
|
+
itemIndicatorElement: FC<MenuItemIndicatorProps>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseSubMenuGroupElementProps } from "./typings.ts";
|
|
3
|
+
export declare const BaseSubMenuGroup: import("react").NamedExoticComponent<Omit<import("../typings.ts").BaseMenuGroupProps<import("./typings.ts").BaseSubMenuItemProps>, "closeOnSelect"> & Omit<import("@radix-ui/react-menu").MenuGroupProps, "color" | "asChild"> & BaseSubMenuGroupElementProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { MenuGroupProps, MenuSubContentProps, MenuSubProps, MenuSubTriggerProps } from "@radix-ui/react-menu";
|
|
3
|
+
import { BaseMenuItemProps, BaseMenuGroupProps } from "../typings.ts";
|
|
4
|
+
export type BaseSubMenuItemProps = BaseMenuItemProps & Omit<MenuSubTriggerProps, "asChild" | "content"> & {
|
|
5
|
+
triggerIndicator: ReactNode;
|
|
6
|
+
subContent: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type BaseSubMenuGroupProps = Omit<BaseMenuGroupProps<BaseSubMenuItemProps>, "closeOnSelect"> & Omit<MenuGroupProps, "asChild" | "color">;
|
|
9
|
+
export interface BaseSubMenuGroupElementProps {
|
|
10
|
+
groupElement: FC<MenuGroupProps>;
|
|
11
|
+
subElement: FC<MenuSubProps>;
|
|
12
|
+
subTriggerElement: FC<MenuSubTriggerProps>;
|
|
13
|
+
subContentElement: FC<Omit<MenuSubContentProps, "color">>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { DropdownMenu as RadixDropdownMenu } from "@radix-ui/themes";
|
|
3
|
+
import { AllOrNone } from "../utils.ts";
|
|
4
|
+
export interface BaseMenuGroupProps<TItemProps> {
|
|
5
|
+
closeOnSelect?: boolean;
|
|
6
|
+
items: TItemProps[];
|
|
7
|
+
separator?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface BaseMenuItemProps {
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export type TextFilterProps = AllOrNone<{
|
|
13
|
+
/** the current value in the user input contained within the dropdown selects */
|
|
14
|
+
filterValue?: string;
|
|
15
|
+
/** callback fired when an item in the dropdown select is clicked*/
|
|
16
|
+
onFilterValueChange?: (value: string) => void;
|
|
17
|
+
/** placeholder for the user input contained within the dropdown select */
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
icons?: {
|
|
20
|
+
left?: ReactNode;
|
|
21
|
+
right?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
/** Type for props retaining to all DropdownMenu & ContextMenu variants, the type representing props for those components
|
|
25
|
+
* should all include these */
|
|
26
|
+
export type BaseMenuProps = {
|
|
27
|
+
/** a ReactElement representing the trigger for the Base Menu, must be clickable */
|
|
28
|
+
trigger: ReactElement;
|
|
29
|
+
/** the disabled state of the Base Menu
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** determines on which side of the trigger the dropdown select renders on, if open space
|
|
34
|
+
* @default "bottom"
|
|
35
|
+
* */
|
|
36
|
+
side?: ComponentProps<typeof RadixDropdownMenu.Content>["side"];
|
|
37
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MenuItemProps } from "@radix-ui/react-menu";
|
|
2
|
+
import { ChangeEvent } from "react";
|
|
3
|
+
import { TextFilterProps } from "./typings.ts";
|
|
4
|
+
export declare const useCloseOnSelectHandler: (closeOnSelect: boolean) => (onSelect: MenuItemProps["onSelect"]) => (event: Event) => void;
|
|
5
|
+
export declare const useTextFilterChangeHandler: () => (onTextFilterChange: TextFilterProps["onFilterValueChange"]) => (event: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CloseDialogOptions, CloseDialogWithOptions } from "./typings.ts";
|
|
2
|
+
/** This custom hook is used as a utility for wrapping a general callback in callback that accepts a close function for the
|
|
3
|
+
* Blocks dialog component. Sometimes a side effect callback needs to be run upon the closure of a Dialog. This provides
|
|
4
|
+
* a hook to wrap a callback with the returned close function passed to the Dialog Content. This allows the closure of
|
|
5
|
+
* the Dialog and the callback to be run simultaneously. It also saves the developer from attaching callback logic with
|
|
6
|
+
* the close functionality of the Dialog. */
|
|
7
|
+
export declare const useWrapCallbackInDialogClose: (callback: (...arg: never[]) => void, closeOptions: CloseDialogOptions) => (...arg: never[]) => (closeDialog: CloseDialogWithOptions) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { DropdownMenuItemGroupItemProps, DropdownMenuItemGroupProps } from "../DropdownMenu/DropdownMenuGroups.tsx";
|
|
3
|
+
import { BaseMenuProps } from "../BaseMenuGroups";
|
|
4
|
+
export type DropdownItemMenuItemProps = DropdownMenuItemGroupItemProps;
|
|
5
|
+
export type DropdownItemMenuProps = DropdownMenuItemGroupProps & BaseMenuProps;
|
|
6
|
+
/** The DropdownItemMenu component is a user interface element that provides a list of options for the user to choose from.
|
|
7
|
+
* It is commonly used in web applications to present a set of related choices in a compact and organized manner.
|
|
8
|
+
* This DropdownItemMenu component is a wrapper around the Radix-UI DropdownItemMenu component that can be found here https://www.radix-ui.com/themes/docs/components/dropdown-menu */
|
|
9
|
+
export declare const DropdownItemMenu: FC<DropdownItemMenuProps>;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
closeOnSelect?: boolean;
|
|
7
|
-
separator?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface DropdownMenuProps extends Omit<ComponentProps<typeof RadixDropdownMenu.Content>, "asChild" | "color" | "children"> {
|
|
10
|
-
severity?: Severity;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
label?: string;
|
|
13
|
-
trigger: ReactElement;
|
|
14
|
-
items: DropdownMenuItemProps[];
|
|
15
|
-
modal?: boolean;
|
|
16
|
-
closeOnSelect?: boolean;
|
|
17
|
-
}
|
|
1
|
+
import { FC, PropsWithChildren } from "react";
|
|
2
|
+
import { DropdownMenuItemGroupItemProps } from "./DropdownMenuGroups.tsx";
|
|
3
|
+
import { BaseMenuProps } from "../BaseMenuGroups";
|
|
4
|
+
export type DropdownMenuItemProps = DropdownMenuItemGroupItemProps;
|
|
5
|
+
export type DropdownMenuProps = PropsWithChildren & BaseMenuProps;
|
|
18
6
|
/** The DropdownMenu component is a user interface element that provides a list of options for the user to choose from.
|
|
19
7
|
* It is commonly used in web applications to present a set of related choices in a compact and organized manner.
|
|
20
8
|
* This DropdownMenu component is a wrapper around the Radix-UI DropdownMenu component that can be found here https://www.radix-ui.com/themes/docs/components/dropdown-menu */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseItemGroupProps, BaseSelectGroupProps, BaseMultiSelectGroupProps, BaseSelectItemProps, BaseItemProps, BaseMultiSelectItemProps, BaseSubMenuGroupProps, BaseSubMenuItemProps } from "../BaseMenuGroups";
|
|
3
|
+
/** Item Group */
|
|
4
|
+
export type DropdownMenuItemGroupItemProps = BaseItemProps;
|
|
5
|
+
export type DropdownMenuItemGroupProps = BaseItemGroupProps;
|
|
6
|
+
export declare const DropdownMenuItemGroup: import("react").NamedExoticComponent<BaseItemGroupProps>;
|
|
7
|
+
/** Select Group */
|
|
8
|
+
export type DropdownMenuSelectGroupItemProps = BaseSelectItemProps;
|
|
9
|
+
export type DropdownMenuSelectGroupProps = BaseSelectGroupProps;
|
|
10
|
+
export declare const DropdownMenuSelectGroup: import("react").NamedExoticComponent<BaseSelectGroupProps>;
|
|
11
|
+
/** MultiSelect Group */
|
|
12
|
+
export type DropdownMenuMultiSelectGroupItemProps = BaseMultiSelectItemProps;
|
|
13
|
+
export type DropdownMenuMultiSelectGroupProps = BaseMultiSelectGroupProps;
|
|
14
|
+
export declare const DropdownMenuMultiSelectGroup: import("react").NamedExoticComponent<BaseMultiSelectGroupProps>;
|
|
15
|
+
/** SubMenu Group */
|
|
16
|
+
export type DropdownMenuSubMenuGroupItemProps = BaseSubMenuItemProps;
|
|
17
|
+
export type DropdownMenuSubMenuGroupProps = BaseSubMenuGroupProps;
|
|
18
|
+
export declare const DropdownMenuSubMenuGroup: import("react").NamedExoticComponent<BaseSubMenuGroupProps>;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { DropdownMenu } from "./DropdownMenu";
|
|
2
2
|
export type { DropdownMenuProps, DropdownMenuItemProps } from "./DropdownMenu";
|
|
3
|
+
export * from "./DropdownMenuGroups";
|
|
4
|
+
export type { DropdownMenuItemGroupProps, DropdownMenuItemGroupItemProps, DropdownMenuSelectGroupProps, DropdownMenuSelectGroupItemProps, DropdownMenuMultiSelectGroupProps, DropdownMenuMultiSelectGroupItemProps, DropdownMenuSubMenuGroupProps, DropdownMenuSubMenuGroupItemProps, } from "./DropdownMenuGroups.tsx";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { DropdownMenuMultiSelectGroupItemProps, DropdownMenuMultiSelectGroupProps } from "../DropdownMenu";
|
|
3
|
+
import { BaseMenuProps } from "../BaseMenuGroups";
|
|
4
|
+
export type DropdownMultiSelectItemProps = DropdownMenuMultiSelectGroupItemProps;
|
|
5
|
+
export type DropdownMultiSelectProps = DropdownMenuMultiSelectGroupProps & BaseMenuProps;
|
|
6
|
+
export declare const DropdownMultiSelect: FC<DropdownMultiSelectProps>;
|
|
@@ -1,58 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
rightInputIcon?: ReactNode;
|
|
7
|
-
selectedItemIcon?: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
export interface DropdownSelectItemProps {
|
|
10
|
-
/** the content to rendered for the dropdown select item */
|
|
11
|
-
content: ReactNode;
|
|
12
|
-
value: string;
|
|
13
|
-
/** the disabled state of the dropdown select item
|
|
14
|
-
* @default false
|
|
15
|
-
* */
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export type DropdownSelectProps = {
|
|
19
|
-
/** currently selected value of the dropdown select*/
|
|
20
|
-
value: string | undefined;
|
|
21
|
-
/** callback fired when an item in the dropdown select is clicked*/
|
|
22
|
-
onValueChange: (value: string | undefined) => void;
|
|
23
|
-
/** a ReactElement representing the trigger for the dropdown select, must be clickable*/
|
|
24
|
-
trigger: ReactElement;
|
|
25
|
-
/** the selectable items to be displayed in the dropdown select */
|
|
26
|
-
items: DropdownSelectItemProps[];
|
|
27
|
-
/** the disabled state of the dropdown select
|
|
28
|
-
* @default false
|
|
29
|
-
* */
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
/** placeholder for the user input contained within the dropdown select */
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
/** determines if the dropdown select should close after selecting an item
|
|
34
|
-
* @default true
|
|
35
|
-
* */
|
|
36
|
-
closeOnSelect?: boolean;
|
|
37
|
-
/** a set of icons to be fill the different icon spots within the dropdown select */
|
|
38
|
-
icons?: DropdownSelectIconProps;
|
|
39
|
-
/** determines on which side of the trigger the dropdown select renders on, if open space
|
|
40
|
-
* @default "bottom"
|
|
41
|
-
* */
|
|
42
|
-
side?: ComponentProps<typeof RadixDropdownMenu.Content>["side"];
|
|
43
|
-
/** severity of the dropdown select
|
|
44
|
-
* @default "info"
|
|
45
|
-
* */
|
|
46
|
-
severity?: Severity;
|
|
47
|
-
} & ({
|
|
48
|
-
/** the current value in the user input contained within the dropdown select */
|
|
49
|
-
filterValue: undefined;
|
|
50
|
-
/** callback fired when an item in the dropdown select is clicked*/
|
|
51
|
-
onFilterValueChange: undefined;
|
|
52
|
-
} | {
|
|
53
|
-
/** the current value in the user input contained within the dropdown select */
|
|
54
|
-
filterValue: string;
|
|
55
|
-
/** callback fired when an item in the dropdown select is clicked*/
|
|
56
|
-
onFilterValueChange: (value: string) => void;
|
|
57
|
-
});
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { DropdownMenuItemGroupItemProps, DropdownMenuSelectGroupProps } from "../DropdownMenu/DropdownMenuGroups.tsx";
|
|
3
|
+
import { BaseMenuProps } from "../BaseMenuGroups";
|
|
4
|
+
export type DropdownSelectItemProps = DropdownMenuItemGroupItemProps;
|
|
5
|
+
export type DropdownSelectProps = DropdownMenuSelectGroupProps & BaseMenuProps;
|
|
58
6
|
export declare const DropdownSelect: FC<DropdownSelectProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DropdownSelect } from "./DropdownSelect";
|
|
2
|
-
export type { DropdownSelectProps, DropdownSelectItemProps
|
|
2
|
+
export type { DropdownSelectProps, DropdownSelectItemProps } from "./DropdownSelect";
|
|
@@ -11,9 +11,10 @@ export interface SeparatorProps extends Omit<ComponentProps<typeof RadixSeparato
|
|
|
11
11
|
/** the weight of the text
|
|
12
12
|
* @default "light"
|
|
13
13
|
* */
|
|
14
|
-
|
|
14
|
+
textWeight?: ComponentProps<typeof Text>["weight"];
|
|
15
15
|
/** severity of the separator
|
|
16
16
|
* @default "info"
|
|
17
17
|
* */
|
|
18
18
|
severity?: Severity;
|
|
19
|
+
weight?: "light" | "medium" | "bold" | "full";
|
|
19
20
|
}
|