@nodeblocks/frontend-list-users-block 0.0.3 → 0.1.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.
- package/dist/context.d.ts +32 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/index.cjs.js +20528 -13357
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +20519 -13348
- package/dist/index.esm.js.map +1 -1
- package/dist/lib.d.ts +72 -15
- package/dist/lib.d.ts.map +1 -1
- package/dist/list-users.d.ts +52 -0
- package/dist/list-users.d.ts.map +1 -0
- package/package.json +6 -5
- package/readme.md +9 -2
- package/dist/ListUsers.d.ts +0 -109
- package/dist/ListUsers.d.ts.map +0 -1
- package/dist/blocks.d.ts +0 -17
- package/dist/blocks.d.ts.map +0 -1
package/dist/lib.d.ts
CHANGED
|
@@ -1,24 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentProps, FunctionComponent, ReactElement, ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The function to be passed into a block component as `children` to selectively override default blocks, or just a `ReactNode`.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* @example
|
|
6
|
+
* <Block>
|
|
7
|
+
* {({ defaultBlocks: { header, ...defaultBlocks }, defaultBlockOrder }) => ({
|
|
8
|
+
* blocks: {
|
|
9
|
+
* ...defaultBlocks,
|
|
10
|
+
* header: {
|
|
11
|
+
* ...header,
|
|
12
|
+
* props: {
|
|
13
|
+
* ...header.props,
|
|
14
|
+
* label: "Custom Label"
|
|
15
|
+
* }
|
|
16
|
+
* },
|
|
17
|
+
* subheader: <CustomComponent />
|
|
18
|
+
* },
|
|
19
|
+
* blockOrder: ["header", "subheader", "body", "footer"]
|
|
20
|
+
* })}
|
|
21
|
+
* </Block>
|
|
9
22
|
*/
|
|
10
|
-
type
|
|
23
|
+
export type BlocksOverride<DefaultBlocks, CustomBlocks> = (({ defaultBlocks, defaultBlockOrder, }: {
|
|
11
24
|
defaultBlocks: DefaultBlocks;
|
|
25
|
+
defaultBlockOrder: readonly (keyof DefaultBlocks)[];
|
|
26
|
+
}) => {
|
|
27
|
+
blocks: Partial<DefaultBlocks> & CustomBlocks;
|
|
28
|
+
blockOrder: readonly (keyof DefaultBlocks)[] | readonly (keyof CustomBlocks)[];
|
|
29
|
+
}) | ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
|
|
32
|
+
*
|
|
33
|
+
* @param components - A map of default block keys to component functions.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* const defaultBlocks = createDefaultBlocks({
|
|
37
|
+
* title: Title,
|
|
38
|
+
* description: Description,
|
|
39
|
+
* form: Form,
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
export declare function createDefaultBlocks<T extends Record<string, FunctionComponent<any>>>(components: T): {
|
|
43
|
+
[K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;
|
|
12
44
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
45
|
+
/**
|
|
46
|
+
* A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
|
|
47
|
+
* Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
|
|
48
|
+
*
|
|
49
|
+
* @param props
|
|
50
|
+
* @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
|
|
51
|
+
* @param props.defaultBlocks - The default blocks of outer component.
|
|
52
|
+
* @param props.children - A function returning the JSX to render.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* <BlocksOverrideComponent
|
|
56
|
+
* defaultBlocks={defaultFormBlocks}
|
|
57
|
+
* blocksOverride={children}
|
|
58
|
+
* >
|
|
59
|
+
* {({ blocks, blockOrder }) =>
|
|
60
|
+
* blockOrder.map((key) => (
|
|
61
|
+
* <Fragment key={String(key)}>{blocks[key]}</Fragment>
|
|
62
|
+
* ))
|
|
63
|
+
* }
|
|
64
|
+
* </BlocksOverrideComponent>
|
|
65
|
+
*/
|
|
66
|
+
export declare function BlocksOverrideComponent<DefaultBlocks extends Record<string, ReactNode>, CustomBlocks extends Record<string, ReactNode>>({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }: {
|
|
67
|
+
blocksOverride: BlocksOverride<DefaultBlocks, CustomBlocks>;
|
|
68
|
+
defaultBlocks: DefaultBlocks;
|
|
69
|
+
defaultBlockOrder: (keyof DefaultBlocks)[];
|
|
70
|
+
children: ({ blocks, blockOrder, }: {
|
|
71
|
+
blocks: Partial<DefaultBlocks> & Partial<CustomBlocks>;
|
|
72
|
+
blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];
|
|
73
|
+
}) => ReactNode;
|
|
74
|
+
}): ReactNode;
|
|
75
|
+
type MergeTypes<Object1, Object2> = {
|
|
76
|
+
[K in keyof Object1 | keyof Object2]: K extends keyof Object1 ? Object1[K] : K extends keyof Object2 ? Object2[K] : never;
|
|
21
77
|
};
|
|
78
|
+
export declare function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B): MergeTypes<B, A>;
|
|
22
79
|
type ClassName = string | ClassName[] | undefined | null;
|
|
23
80
|
/**
|
|
24
81
|
* Utility function to join class names together, ignoring undefined or nil values.
|
package/dist/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,iBAAiB,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CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QACvD,UAAU,EAAE,SAAS,CAAC,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,EAAE,CAAC;KACnE,KAAK,SAAS,CAAC;CACjB,aAmBA;AAED,KAAK,UAAU,CAAC,OAAO,EAAE,OAAO,IAAI;KACjC,CAAC,IAAI,MAAM,OAAO,GAAG,MAAM,OAAO,GAAG,CAAC,SAAS,MAAM,OAAO,GACzD,OAAO,CAAC,CAAC,CAAC,GACV,CAAC,SAAS,MAAM,OAAO,GACrB,OAAO,CAAC,CAAC,CAAC,GACV,KAAK;CACZ,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAmBrF,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAClC;AAED,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PaginationProps, Tab, Table, Typography } from '@basaldev/blocks-frontend-framework';
|
|
2
|
+
import '@basaldev/blocks-frontend-framework/dist/style.css';
|
|
3
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
4
|
+
import { BlocksOverride } from './lib';
|
|
5
|
+
import './list-users.css';
|
|
6
|
+
export interface ListUsersRowData {
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
name: string;
|
|
10
|
+
status: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ListUsers: {
|
|
13
|
+
<Tabs extends ComponentProps<typeof Tab>["tabs"], CustomBlocks extends Record<string, ReactNode> = {}>({ listUsersTitle, isLoading, labels, onNavigate, pagination, data, rowHref, tabs, currentTab, onTabChange, className, children, ...props }: Omit<ComponentProps<"div">, "children"> & {
|
|
14
|
+
listUsersTitle: ReactNode;
|
|
15
|
+
isLoading?: boolean;
|
|
16
|
+
labels: {
|
|
17
|
+
emptyStateMessage: string;
|
|
18
|
+
headerRow: {
|
|
19
|
+
createdAt: string;
|
|
20
|
+
name: string;
|
|
21
|
+
status: string;
|
|
22
|
+
};
|
|
23
|
+
cellData: {
|
|
24
|
+
statusInUse: string;
|
|
25
|
+
statusNotInUse: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
onNavigate?: (to: string) => void;
|
|
29
|
+
pagination?: PaginationProps;
|
|
30
|
+
data: ListUsersRowData[];
|
|
31
|
+
rowHref?: (row: ListUsersRowData) => string;
|
|
32
|
+
tabs?: Tabs;
|
|
33
|
+
currentTab?: Tabs[number]["label"];
|
|
34
|
+
onTabChange?: (tab: Tabs[number]["label"]) => void;
|
|
35
|
+
children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
Title(props: Partial<ComponentProps<typeof Typography>>): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
Header(props: Partial<ComponentProps<"div">>): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
Loader(props: Partial<ComponentProps<"div">>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
Content(props: Partial<ComponentProps<"div">>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
Tabs<Tabs extends ComponentProps<typeof Tab>["tabs"]>(props: Partial<ComponentProps<typeof Tab>>): import("react/jsx-runtime").JSX.Element | undefined;
|
|
42
|
+
Table<Tabs extends ComponentProps<typeof Tab>["tabs"]>(props: Partial<ComponentProps<typeof Table<ListUsersRowData>>>): import("react/jsx-runtime").JSX.Element | undefined;
|
|
43
|
+
};
|
|
44
|
+
declare const defaultBlocks: {
|
|
45
|
+
title: import("react").ReactElement<Partial<import("@basaldev/blocks-frontend-framework").TypographyProps>, (props: Partial<ComponentProps<typeof Typography>>) => import("react/jsx-runtime").JSX.Element>;
|
|
46
|
+
header: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, (props: Partial<ComponentProps<"div">>) => import("react/jsx-runtime").JSX.Element>;
|
|
47
|
+
content: import("react").ReactElement<Partial<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, (props: Partial<ComponentProps<"div">>) => import("react/jsx-runtime").JSX.Element>;
|
|
48
|
+
tabs: import("react").ReactElement<Partial<import("@basaldev/blocks-frontend-framework").TabProps>, <Tabs extends ComponentProps<typeof Tab>["tabs"]>(props: Partial<ComponentProps<typeof Tab>>) => import("react/jsx-runtime").JSX.Element | undefined>;
|
|
49
|
+
table: import("react").ReactElement<Partial<import("@basaldev/blocks-frontend-framework").TableProps<ListUsersRowData>>, <Tabs extends ComponentProps<typeof Tab>["tabs"]>(props: Partial<ComponentProps<typeof Table<ListUsersRowData>>>) => import("react/jsx-runtime").JSX.Element | undefined>;
|
|
50
|
+
};
|
|
51
|
+
export default ListUsers;
|
|
52
|
+
//# sourceMappingURL=list-users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-users.d.ts","sourceRoot":"","sources":["../src/list-users.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,eAAe,EAEf,GAAG,EACH,KAAK,EACL,UAAU,EACX,MAAM,qCAAqC,CAAC;AAC7C,OAAO,oDAAoD,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAY,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,cAAc,EAA2D,MAAM,OAAO,CAAC;AAChG,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE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CAAC,CAAC;kBAc9B,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;mBAU7B,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;SAkBxC,IAAI,SAAS,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;UAM1F,IAAI,SAAS,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,SACzD,OAAO,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;CA7D/D,CAAC;AAyGF,QAAA,MAAM,aAAa;wHAvGO,OAAO,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;6JAUzC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;8JAwB7B,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;yGAkBxC,IAAI,SAAS,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC;8HAM1F,IAAI,SAAS,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,SACzD,OAAO,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAkD9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeblocks/frontend-list-users-block",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"browser": "dist/index.iife.js",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rollup -c",
|
|
14
|
-
"watch": "rollup -c --watch"
|
|
14
|
+
"watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": "^18.3.1",
|
|
18
|
-
"react-dom": "^18.
|
|
18
|
+
"react-dom": "^18.3.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
21
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
22
22
|
"@rollup/plugin-json": "^6.1.0",
|
|
23
23
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
24
24
|
"@rollup/plugin-typescript": "^12.1.1",
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
"@types/react-dom": "^18.3.1",
|
|
27
27
|
"rollup": "^4.28.0",
|
|
28
28
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
29
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
29
30
|
"rollup-plugin-postcss": "^4.0.2",
|
|
30
31
|
"rollup-plugin-serve": "^1.1.1",
|
|
31
32
|
"tslib": "^2.8.1",
|
|
32
33
|
"typescript": "^5.7.2"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@basaldev/blocks-frontend-framework": "^3.
|
|
36
|
+
"@basaldev/blocks-frontend-framework": "^4.3.6",
|
|
36
37
|
"@fontsource/material-symbols-outlined": "^5.2.5",
|
|
37
38
|
"@tanstack/react-table": "^8.21.2"
|
|
38
39
|
}
|
package/readme.md
CHANGED
|
@@ -3,24 +3,29 @@
|
|
|
3
3
|
Welcome to the Nodeblocks Frontend Starter Kit! 🎉 This kit is designed to make building frontend libraries in React super easy, helping you streamline your development workflow with minimal fuss. Let's dive in! 🤿
|
|
4
4
|
|
|
5
5
|
### ✨ Features
|
|
6
|
+
|
|
6
7
|
- **🚀 Bundling with Rollup:** Get a clean, minimalistic approach to bundling your JavaScript files for smoother frontend development.
|
|
7
8
|
- **💙 TypeScript Support:** We've included a pre-configured `tsconfig.json` to ensure your TypeScript setup is strict, efficient, and ready to go.
|
|
8
9
|
- **⚙️ Peer Dependencies:** Keep bundle sizes lean with React and React DOM set as peer dependencies.
|
|
9
10
|
- **🎨 CSS Support:** Easily import and process CSS files, giving you more control over your styles.
|
|
10
11
|
|
|
11
12
|
### 🛠️ How to Use
|
|
13
|
+
|
|
12
14
|
1. **Clone this repository** 🌀:
|
|
15
|
+
|
|
13
16
|
```bash
|
|
14
17
|
git clone <repository-url>
|
|
15
18
|
cd <repository-directory>
|
|
16
19
|
```
|
|
17
20
|
|
|
18
21
|
2. **Install dependencies** 📦:
|
|
22
|
+
|
|
19
23
|
```bash
|
|
20
24
|
npm install
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
3. **Start development** 🛠️:
|
|
28
|
+
|
|
24
29
|
```bash
|
|
25
30
|
npm run watch
|
|
26
31
|
```
|
|
@@ -48,10 +53,12 @@ This ensures Nodeblocks libraries integrate seamlessly with different workflows.
|
|
|
48
53
|
npm link
|
|
49
54
|
```
|
|
50
55
|
2. In the test project you want to run:
|
|
56
|
+
|
|
51
57
|
```bash
|
|
52
58
|
npm i
|
|
53
59
|
npm link @basaldev/frontend-starter-kit
|
|
54
60
|
```
|
|
55
|
-
(Note that in real life your library would not be called frontend-starter-kit.)
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
(Note that in real life your library would not be called frontend-starter-kit.)
|
|
63
|
+
|
|
64
|
+
3. Then you can follow your usual workflow either with **Create React App** (`npm start`) or with Vite (`npm run dev`). This will give you a development environment where whenever you change your library it will be available in your test project.
|
package/dist/ListUsers.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { InputHTMLAttributes } from "react";
|
|
2
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
3
|
-
import { IconType, MenuItemProps } from "@basaldev/blocks-frontend-framework";
|
|
4
|
-
import { DefaultBlocks } from "./blocks";
|
|
5
|
-
import "@basaldev/blocks-frontend-framework/dist/style.css";
|
|
6
|
-
import "@fontsource/material-symbols-outlined/400.css";
|
|
7
|
-
import "./list-user.css";
|
|
8
|
-
type InputAction = InputHTMLAttributes<HTMLInputElement> & {
|
|
9
|
-
className?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Default value. This is used for initially setting up the input when used without
|
|
12
|
-
* controlled value. If you want to use controlled value, use `value` prop instead.
|
|
13
|
-
*/
|
|
14
|
-
defaultValue?: string;
|
|
15
|
-
/** Error text */
|
|
16
|
-
errorText?: string;
|
|
17
|
-
/** Is input disabled */
|
|
18
|
-
isDisabled?: boolean;
|
|
19
|
-
/** Shows red required mark */
|
|
20
|
-
isRequired?: boolean;
|
|
21
|
-
/** Label of the input field */
|
|
22
|
-
label?: string;
|
|
23
|
-
/** Configurable label weight */
|
|
24
|
-
labelWeight?: "bold" | "regular";
|
|
25
|
-
/** Input name */
|
|
26
|
-
name?: string;
|
|
27
|
-
/** On Input change callback */
|
|
28
|
-
onChange?: (value: string, name?: string) => void;
|
|
29
|
-
/** On enter pressed callback */
|
|
30
|
-
onEnter?: (value: string, name?: string) => void;
|
|
31
|
-
/** Operation onClick callback */
|
|
32
|
-
onOperationClick?: () => void;
|
|
33
|
-
/** Operation text */
|
|
34
|
-
operationText?: string;
|
|
35
|
-
/** Placeholder */
|
|
36
|
-
placeholder?: string;
|
|
37
|
-
/** Text to place after the component */
|
|
38
|
-
postfixText?: string;
|
|
39
|
-
/** Set input to readonly */
|
|
40
|
-
readonly?: boolean;
|
|
41
|
-
/** Input value */
|
|
42
|
-
value?: string;
|
|
43
|
-
};
|
|
44
|
-
type ButtonAction = {
|
|
45
|
-
className: string;
|
|
46
|
-
name?: string;
|
|
47
|
-
label?: string;
|
|
48
|
-
icon?: IconType;
|
|
49
|
-
onClick: () => void;
|
|
50
|
-
};
|
|
51
|
-
type ListUsersProps<TRowData extends {
|
|
52
|
-
[k: string]: any;
|
|
53
|
-
}> = {
|
|
54
|
-
title?: string;
|
|
55
|
-
children?: (props: {
|
|
56
|
-
defaultBlocks: DefaultBlocks;
|
|
57
|
-
}) => {
|
|
58
|
-
blocks: DefaultBlocks;
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
};
|
|
61
|
-
emptyDataView?: {
|
|
62
|
-
message?: string;
|
|
63
|
-
icon?: IconType;
|
|
64
|
-
};
|
|
65
|
-
tableView?: {
|
|
66
|
-
headerRow?: {
|
|
67
|
-
[key: string]: string;
|
|
68
|
-
} & {
|
|
69
|
-
name: string;
|
|
70
|
-
createdAt: string;
|
|
71
|
-
status: string;
|
|
72
|
-
};
|
|
73
|
-
cellData?: {
|
|
74
|
-
[key: string]: string;
|
|
75
|
-
} & {
|
|
76
|
-
statusNotInUse: string;
|
|
77
|
-
statusInUse: string;
|
|
78
|
-
};
|
|
79
|
-
dropdownMenu?: (cell: TRowData) => Array<Omit<MenuItemProps, "onNavigate">>;
|
|
80
|
-
};
|
|
81
|
-
actions?: {
|
|
82
|
-
search?: InputAction;
|
|
83
|
-
filter?: ButtonAction;
|
|
84
|
-
};
|
|
85
|
-
columns?: Array<{
|
|
86
|
-
accessor: (row: TRowData) => unknown;
|
|
87
|
-
props: Omit<ColumnDef<TRowData, any>, "accessorFn" | "accessorKey">;
|
|
88
|
-
}>;
|
|
89
|
-
data?: Array<TRowData>;
|
|
90
|
-
showLoading?: boolean;
|
|
91
|
-
rowHref?: (row: TRowData) => string;
|
|
92
|
-
pagination?: {
|
|
93
|
-
/** Custom class to give the html component */
|
|
94
|
-
className?: string;
|
|
95
|
-
/** Currently selected page in the pagination. Pages are counted from 1. */
|
|
96
|
-
currentPage: number;
|
|
97
|
-
/** Callback when the page is changed */
|
|
98
|
-
onPageChange: (page: number) => void;
|
|
99
|
-
/** Total number of pages in the pagination. */
|
|
100
|
-
totalPages: number;
|
|
101
|
-
};
|
|
102
|
-
className?: string;
|
|
103
|
-
onNavigate?: ((to: string) => void);
|
|
104
|
-
};
|
|
105
|
-
declare const ListUsers: <TRowData extends {
|
|
106
|
-
[k: string]: any;
|
|
107
|
-
}>({ title, showLoading, emptyDataView, tableView, actions, columns, children, data, pagination, rowHref, className, onNavigate }: ListUsersProps<TRowData>) => import("react/jsx-runtime").JSX.Element;
|
|
108
|
-
export default ListUsers;
|
|
109
|
-
//# sourceMappingURL=ListUsers.d.ts.map
|
package/dist/ListUsers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListUsers.d.ts","sourceRoot":"","sources":["../src/ListUsers.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,SAAS,EAGV,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAGL,QAAQ,EAMR,aAAa,EAEd,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAS,aAAa,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,oDAAoD,CAAC;AAC5D,OAAO,+CAA+C,CAAC;AACvD,OAAO,iBAAiB,CAAC;AAEzB,KAAK,WAAW,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,iBAAiB;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,gCAAgC;IAChC,OAAO,CAAC,EAAE,CAAC,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E,EAAE,gIAavD,cAAc,CAAC,QAAQ,CAAC,4CAyG1B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/blocks.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type Block<T extends unknown = {
|
|
3
|
-
[k: string]: any;
|
|
4
|
-
}> = (props: T) => React.ReactNode;
|
|
5
|
-
export type DefaultBlocks = {
|
|
6
|
-
Title: Block<{
|
|
7
|
-
[k: string]: any;
|
|
8
|
-
}>;
|
|
9
|
-
Actions: Block<{
|
|
10
|
-
[k: string]: any;
|
|
11
|
-
}>;
|
|
12
|
-
Table: Block<{
|
|
13
|
-
[k: string]: any;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
export type DefaultOptions = {};
|
|
17
|
-
//# sourceMappingURL=blocks.d.ts.map
|
package/dist/blocks.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI,CAC5D,KAAK,EAAE,CAAC,KACL,KAAK,CAAC,SAAS,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAC;IACnC,OAAO,EAAE,KAAK,CAAC;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,EAAE,CAAC"}
|