@overmap-ai/blocks 0.0.9 → 0.0.10-alpha.1

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 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,27 @@
1
+ import { Link } from "@radix-ui/themes";
2
+ import { FlexProps } from "../Flex";
3
+ import { ComponentProps, HTMLProps, ReactNode } from "react";
4
+ import { Severity } from "../typings.ts";
5
+ export interface BreadcrumbItemProps extends Omit<HTMLProps<HTMLAnchorElement>, "size" | "ref" | "color"> {
6
+ }
7
+ export declare const Item: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<BreadcrumbItemProps & import("react").RefAttributes<HTMLAnchorElement>>>;
8
+ export interface BreadcrumbGroupProps extends Omit<HTMLProps<HTMLDivElement>, "height" | "width" | "wrap" | "ref" | "size"> {
9
+ children: ReactNode;
10
+ /** The separator used in between Breadcrumb items*/
11
+ separator: ReactNode;
12
+ /** The severity of the items in the Breadcrumb
13
+ * @default "info"
14
+ * */
15
+ severity?: Severity;
16
+ /** The text size of the items in the Breadcrumb */
17
+ size?: ComponentProps<typeof Link>["size"];
18
+ /** The gap between Breadcrumb items
19
+ * @default "2"
20
+ * */
21
+ gap?: FlexProps["gap"];
22
+ }
23
+ export declare const Group: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<BreadcrumbGroupProps & import("react").RefAttributes<HTMLDivElement>>>;
24
+ export declare const Breadcrumb: {
25
+ Group: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<BreadcrumbGroupProps & import("react").RefAttributes<HTMLDivElement>>>;
26
+ Item: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<BreadcrumbItemProps & import("react").RefAttributes<HTMLAnchorElement>>>;
27
+ };
@@ -0,0 +1,10 @@
1
+ import type { Severity } from "../typings.ts";
2
+ import { ComponentProps } from "react";
3
+ import { Link } from "@radix-ui/themes";
4
+ interface IBreadcrumbContext {
5
+ severity: Severity;
6
+ size: ComponentProps<typeof Link>["size"];
7
+ }
8
+ export declare const BreadcrumbContext: import("react").Context<IBreadcrumbContext>;
9
+ export declare const useBreadcrumbContext: () => IBreadcrumbContext;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Breadcrumb } from "./Breadcrumb";
2
+ export type { BreadcrumbGroupProps, BreadcrumbItemProps } from "./Breadcrumb";
@@ -0,0 +1,58 @@
1
+ import { DropdownMenu as RadixDropdownMenu } from "@radix-ui/themes";
2
+ import { ComponentProps, FC, ReactElement, ReactNode } from "react";
3
+ import { Severity } from "../typings.ts";
4
+ export interface DropdownSelectIconProps {
5
+ leftInputIcon?: ReactNode;
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
+ });
58
+ export declare const DropdownSelect: FC<DropdownSelectProps>;
@@ -0,0 +1,2 @@
1
+ export { DropdownSelect } from "./DropdownSelect";
2
+ export type { DropdownSelectProps, DropdownSelectItemProps, DropdownSelectIconProps } from "./DropdownSelect";
@@ -0,0 +1,3 @@
1
+ import { FC } from "react";
2
+ import { TableProps } from "./typings";
3
+ export declare const Table: FC<TableProps>;
@@ -0,0 +1,151 @@
1
+ export declare const TableData: string[][];
2
+ export declare const DefaultTableColumns: (sort?: boolean, search?: boolean, filter?: boolean) => ({
3
+ id: string;
4
+ label: string;
5
+ sort: boolean;
6
+ search: boolean;
7
+ filter?: undefined;
8
+ } | {
9
+ id: string;
10
+ label: string;
11
+ sort: boolean;
12
+ search: boolean;
13
+ filter: boolean;
14
+ } | {
15
+ id: string;
16
+ label: string;
17
+ sort: boolean;
18
+ search?: undefined;
19
+ filter?: undefined;
20
+ })[];
21
+ export declare const DefaultTableRows: (len: number) => {
22
+ id: string;
23
+ columns: {
24
+ full_name: {
25
+ id: string;
26
+ value: string | undefined;
27
+ label: string | undefined;
28
+ };
29
+ job_title: {
30
+ id: string;
31
+ value: string | undefined;
32
+ label: string | undefined;
33
+ };
34
+ gender: {
35
+ id: string;
36
+ value: string | undefined;
37
+ label: string | undefined;
38
+ };
39
+ age: {
40
+ id: string;
41
+ value: string | undefined;
42
+ label: string | undefined;
43
+ };
44
+ annual_salary: {
45
+ id: string;
46
+ value: string | undefined;
47
+ label: string | undefined;
48
+ };
49
+ country: {
50
+ id: string;
51
+ value: string | undefined;
52
+ label: string | undefined;
53
+ };
54
+ };
55
+ }[];
56
+ export declare const AdvancedTableColumns: () => ({
57
+ id: string;
58
+ label: string;
59
+ sort: boolean;
60
+ search: boolean;
61
+ width: string;
62
+ filter?: undefined;
63
+ filterValues?: undefined;
64
+ } | {
65
+ id: string;
66
+ label: string;
67
+ search: boolean;
68
+ filter: boolean;
69
+ width: string;
70
+ sort?: undefined;
71
+ filterValues?: undefined;
72
+ } | {
73
+ id: string;
74
+ label: string;
75
+ sort: boolean;
76
+ filter: boolean;
77
+ search?: undefined;
78
+ width?: undefined;
79
+ filterValues?: undefined;
80
+ } | {
81
+ id: string;
82
+ label: string;
83
+ sort: boolean;
84
+ search?: undefined;
85
+ width?: undefined;
86
+ filter?: undefined;
87
+ filterValues?: undefined;
88
+ } | {
89
+ id: string;
90
+ label: string;
91
+ sort: boolean;
92
+ filter: boolean;
93
+ filterValues: {
94
+ value: number;
95
+ label: import("react/jsx-runtime").JSX.Element;
96
+ }[];
97
+ search?: undefined;
98
+ width?: undefined;
99
+ } | {
100
+ id: string;
101
+ label: string;
102
+ sort?: undefined;
103
+ search?: undefined;
104
+ width?: undefined;
105
+ filter?: undefined;
106
+ filterValues?: undefined;
107
+ })[];
108
+ export declare const AdvancedTableRows: (len: number) => {
109
+ id: string;
110
+ onClick: () => void;
111
+ columns: {
112
+ full_name: {
113
+ id: string;
114
+ value: string | undefined;
115
+ label: string | undefined;
116
+ };
117
+ job_title: {
118
+ id: string;
119
+ value: string | undefined;
120
+ label: string | undefined;
121
+ };
122
+ gender: {
123
+ id: string;
124
+ value: string | undefined;
125
+ label: import("react/jsx-runtime").JSX.Element;
126
+ sortValue: number;
127
+ };
128
+ age: {
129
+ id: string;
130
+ value: string | undefined;
131
+ label: string | undefined;
132
+ };
133
+ annual_salary: {
134
+ id: string;
135
+ value: string | undefined;
136
+ label: string | undefined;
137
+ filterValue: number;
138
+ };
139
+ country: {
140
+ id: string;
141
+ value: string | undefined;
142
+ label: string | undefined;
143
+ searchValue: string;
144
+ };
145
+ remove_user: {
146
+ id: string;
147
+ value: number;
148
+ label: import("react/jsx-runtime").JSX.Element;
149
+ };
150
+ };
151
+ }[];
@@ -0,0 +1,3 @@
1
+ export * from "./Table";
2
+ export * from "./typings.ts";
3
+ export * from "./constants.tsx";
@@ -0,0 +1,63 @@
1
+ import { ReactNode } from "react";
2
+ export type IdLabel = string | number;
3
+ export type ValueLabel = IdLabel | null | undefined;
4
+ export type TableLabel = ValueLabel | ReactNode;
5
+ export interface FilterValue {
6
+ value: ValueLabel;
7
+ label: ReactNode;
8
+ }
9
+ export interface TableCell {
10
+ id: IdLabel;
11
+ value: ValueLabel;
12
+ label: TableLabel;
13
+ onClick?: (cell: TableCell) => void;
14
+ filterValue?: ValueLabel;
15
+ sortValue?: ValueLabel;
16
+ searchValue?: ValueLabel;
17
+ className?: string;
18
+ }
19
+ export interface TableColumn {
20
+ id: IdLabel;
21
+ label: TableLabel;
22
+ sort?: boolean;
23
+ search?: boolean;
24
+ filter?: boolean;
25
+ width?: string;
26
+ className?: string;
27
+ filterValues?: FilterValue[];
28
+ }
29
+ export interface TableRow {
30
+ id: IdLabel;
31
+ onClick?: (row: TableRow) => void;
32
+ className?: string;
33
+ columns: {
34
+ [columnId: string]: TableCell;
35
+ };
36
+ }
37
+ export interface TableProps {
38
+ columns: TableColumn[];
39
+ data: TableRow[];
40
+ color?: "light" | "dark";
41
+ title?: string | ReactNode;
42
+ description?: string | ReactNode;
43
+ rowsPerPage?: number[];
44
+ showSearchBar?: boolean;
45
+ searchBarPlaceholder?: string;
46
+ showSelect?: boolean;
47
+ showFilterButton?: boolean;
48
+ showContainer?: boolean;
49
+ showRowsPerPage?: boolean;
50
+ showPageNumber?: boolean;
51
+ showPageNavigation?: boolean;
52
+ children?: ReactNode;
53
+ /**
54
+ * Show top bar content which includes search bar, filter button, and edit and delete buttons
55
+ * @default false
56
+ */
57
+ showTopBar?: boolean;
58
+ showBottomBar?: boolean;
59
+ className?: string;
60
+ columnClassName?: string;
61
+ rowClassName?: string;
62
+ cellClassName?: string;
63
+ }