@nodeblocks/frontend-list-organization-block 0.3.0 โ†’ 0.4.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.
@@ -1,118 +0,0 @@
1
- import { StackProps } from '@mui/material';
2
- import { ComponentProps, type ReactNode, type SyntheticEvent } from 'react';
3
- import { BaseTable, type BaseTableSearchChip, type BlocksOverride } from '@nodeblocks/frontend-base-block';
4
- export interface ListOrganizationsRowData extends Record<string, unknown> {
5
- id: string;
6
- createdAt: string;
7
- name: string;
8
- joinDate: string;
9
- status: string;
10
- }
11
- type ListOrganizationsRowActionType = 'activate' | 'deactivate';
12
- type ListOrganizationsStatusMatch = {
13
- active: string;
14
- inactive: string;
15
- };
16
- export type TabData = {
17
- key: string;
18
- label: string;
19
- isDisabled?: boolean;
20
- subtitle?: string;
21
- };
22
- export interface PaginationProps {
23
- /** Custom class to give the html component */
24
- className?: string;
25
- /** Currently selected page in the pagination. Pages are counted from 1. */
26
- currentPage: number;
27
- /** Callback when the page is changed */
28
- onPageChange: (page: number) => void;
29
- /** Total number of pages in the pagination. */
30
- totalPages: number;
31
- }
32
- type ListOrganizationsLabels = {
33
- emptyStateMessage: string;
34
- searchFieldPlaceholder: string;
35
- rowActions?: {
36
- activate: string;
37
- deactivate: string;
38
- };
39
- headerRow: {
40
- createdAt: string;
41
- name: string;
42
- joinDate: string;
43
- status: string;
44
- };
45
- cellData: {
46
- statusActive: string;
47
- statusInactive: string;
48
- };
49
- };
50
- type ListOrganizationsValue<TTabs extends TabData[] = TabData[]> = {
51
- isLoading?: boolean;
52
- labels: ListOrganizationsLabels;
53
- searchValue?: string;
54
- onSearchFieldChange?: (value: string) => void;
55
- onSearchSubmit?: () => void;
56
- onNavigate?: (to: string) => void;
57
- onItemActivate?: (rowId: ListOrganizationsRowData['id']) => void;
58
- onItemDeactivate?: (rowId: ListOrganizationsRowData['id']) => void;
59
- shouldShowDropdownMenu?: (row: ListOrganizationsRowData) => boolean;
60
- resolveRowAction?: (row: ListOrganizationsRowData) => ListOrganizationsRowActionType[] | undefined;
61
- statusMatch?: ListOrganizationsStatusMatch;
62
- pagination?: PaginationProps;
63
- data: ListOrganizationsRowData[];
64
- rowHref?: (row: ListOrganizationsRowData) => string;
65
- tabs?: TTabs;
66
- currentTab?: TTabs[number]['key'];
67
- onTabChange?: (tab: TTabs[number]['key']) => void;
68
- searchChipsTitle?: ReactNode;
69
- searchChips?: BaseTableSearchChip[];
70
- onSearchChipDelete?: (chip: BaseTableSearchChip, index: number, event: SyntheticEvent) => void;
71
- listOrganizationsTitle: ReactNode;
72
- };
73
- type ListOrganizationsDefaultBlocks = {
74
- title: ReactNode;
75
- action: ReactNode;
76
- header: ReactNode;
77
- loader: ReactNode;
78
- content: ReactNode;
79
- tabs: ReactNode;
80
- searchChips: ReactNode;
81
- table: ReactNode;
82
- pagination: ReactNode;
83
- };
84
- type ListOrganizationsRootPassthroughProps = Omit<StackProps, 'children'>;
85
- type ListOrganizationsProps<TTabs extends TabData[] = TabData[], CustomBlocks extends Record<string, ReactNode> = {}> = ListOrganizationsRootPassthroughProps & Required<Pick<ListOrganizationsValue<TTabs>, 'labels' | 'data' | 'listOrganizationsTitle'>> & Partial<Pick<ListOrganizationsValue<TTabs>, 'isLoading' | 'searchValue' | 'onSearchFieldChange' | 'onSearchSubmit' | 'onNavigate' | 'onItemActivate' | 'onItemDeactivate' | 'shouldShowDropdownMenu' | 'resolveRowAction' | 'statusMatch' | 'pagination' | 'rowHref' | 'tabs' | 'currentTab' | 'onTabChange' | 'searchChipsTitle' | 'searchChips' | 'onSearchChipDelete'>> & {
86
- children?: BlocksOverride<ListOrganizationsDefaultBlocks, CustomBlocks>;
87
- };
88
- type ListOrganizationsTitleProps = ComponentProps<typeof BaseTable.Header.Title> & {
89
- listOrganizationsTitle?: ReactNode;
90
- };
91
- type ListOrganizationsHeaderProps = ComponentProps<typeof BaseTable.Header>;
92
- type ListOrganizationsActionProps = ComponentProps<typeof BaseTable.Header.Actions> & Partial<Pick<ListOrganizationsValue, 'labels' | 'searchValue' | 'onSearchFieldChange' | 'onSearchSubmit'>>;
93
- type ListOrganizationsLoaderProps = ComponentProps<typeof BaseTable.Content.Loader>;
94
- type ListOrganizationsContentProps = ComponentProps<typeof BaseTable.Content>;
95
- type ListOrganizationsTabsProps = ComponentProps<typeof BaseTable.Tabs<ListOrganizationsRowData>>;
96
- type ListOrganizationsBaseTableGridProps = ComponentProps<typeof BaseTable.Content.Grid<ListOrganizationsRowData>>;
97
- /**
98
- * Props for `ListOrganizations.Table`. Managed grid props (`columns`, `rows`, `noRowsOverlay`, โ€ฆ) are
99
- * omitted from the public surface; the empty-state overlay is built from `labels` via `createNoRowsOverlay`.
100
- */
101
- type ListOrganizationsTableProps = Omit<ListOrganizationsBaseTableGridProps, 'columns' | 'rows' | 'rowActions' | 'actionColumn' | 'onRowClick' | 'noRowsOverlay'> & Partial<Pick<ListOrganizationsValue, 'labels' | 'data' | 'onItemActivate' | 'onItemDeactivate' | 'shouldShowDropdownMenu' | 'resolveRowAction' | 'statusMatch' | 'rowHref' | 'onNavigate'>>;
102
- type ListOrganizationsPaginationProps = Partial<Omit<ComponentProps<typeof BaseTable.Pagination>, 'pagination' | 'rows' | 'isLoading'>> & Partial<Pick<ListOrganizationsValue, 'pagination' | 'data' | 'isLoading'>>;
103
- type ListOrganizationsSearchChipsProps = Partial<ComponentProps<typeof BaseTable.SearchChips>>;
104
- type ListOrganizationsComponent = {
105
- <TTabs extends TabData[] = TabData[], CustomBlocks extends Record<string, ReactNode> = {}>(props: ListOrganizationsProps<TTabs, CustomBlocks>): ReactNode;
106
- Title: (props: ListOrganizationsTitleProps) => ReactNode;
107
- Action: (props: ListOrganizationsActionProps) => ReactNode;
108
- Header: (props: ListOrganizationsHeaderProps) => ReactNode;
109
- Loader: (props: ListOrganizationsLoaderProps) => ReactNode;
110
- Content: (props: ListOrganizationsContentProps) => ReactNode;
111
- Tabs: (props: ListOrganizationsTabsProps) => ReactNode;
112
- SearchChips: (props: ListOrganizationsSearchChipsProps) => ReactNode;
113
- Table: (props: ListOrganizationsTableProps) => ReactNode;
114
- Pagination: (props: ListOrganizationsPaginationProps) => ReactNode;
115
- };
116
- declare const ListOrganizations: ListOrganizationsComponent;
117
- export default ListOrganizations;
118
- //# sourceMappingURL=list-organizations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-organizations.d.ts","sourceRoot":"","sources":["../src/list-organizations.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8B,UAAU,EAAkC,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,cAAc,EAAY,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,EACL,SAAS,EAIT,KAAK,mBAAmB,EAExB,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AAOzC,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,8BAA8B,GAAG,UAAU,GAAG,YAAY,CAAC;AAChE,KAAK,4BAA4B,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,YAAY,EAAE,CA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E,iCAAiC,KAAK,SAAS,CAAC;IACrE,KAAK,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,SAAS,CAAC;IACzD,UAAU,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,SAAS,CAAC;CACpE,CAAC;AA4VF,QAAA,MAAM,iBAAiB,EAA4B,0BAA0B,CAAC;AAuK9E,eAAe,iBAAiB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=list-organizations.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-organizations.test.d.ts","sourceRoot":"","sources":["../src/list-organizations.test.tsx"],"names":[],"mappings":""}
package/readme.md DELETED
@@ -1,64 +0,0 @@
1
- ## ๐Ÿš€ Nodeblocks Frontend Starter Kit
2
-
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
-
5
- ### โœจ Features
6
-
7
- - **๐Ÿš€ Bundling with Rollup:** Get a clean, minimalistic approach to bundling your JavaScript files for smoother frontend development.
8
- - **๐Ÿ’™ TypeScript Support:** We've included a pre-configured `tsconfig.json` to ensure your TypeScript setup is strict, efficient, and ready to go.
9
- - **โš™๏ธ Peer Dependencies:** Keep bundle sizes lean with React and React DOM set as peer dependencies.
10
- - **๐ŸŽจ CSS Support:** Easily import and process CSS files, giving you more control over your styles.
11
-
12
- ### ๐Ÿ› ๏ธ How to Use
13
-
14
- 1. **Clone this repository** ๐ŸŒ€:
15
-
16
- ```bash
17
- git clone <repository-url>
18
- cd <repository-directory>
19
- ```
20
-
21
- 2. **Install dependencies** ๐Ÿ“ฆ:
22
-
23
- ```bash
24
- npm install
25
- ```
26
-
27
- 3. **Start development** ๐Ÿ› ๏ธ:
28
-
29
- ```bash
30
- npm run watch
31
- ```
32
-
33
- 4. **Build for production** ๐Ÿ—๏ธ:
34
- ```bash
35
- npm run build
36
- ```
37
-
38
- ### ๐Ÿงช How to Test
39
-
40
- The `test` folder contains examples that demonstrate how to use the libraries you create with this starter kit. These examples show compatibility with various bundlers, such as:
41
-
42
- - **Create React App** (Webpack)
43
- - **Vite** โšก
44
- - **Rollup** (itself) (Coming soon) ๐Ÿ”„
45
- - **Parcel** (Coming soon) ๐Ÿ“ฆ
46
-
47
- This ensures Nodeblocks libraries integrate seamlessly with different workflows. ๐Ÿ› ๏ธโœจ
48
-
49
- **Before running each project make sure you run `npm link`:**
50
-
51
- 1. In the root of this project:
52
- ```bash
53
- npm link
54
- ```
55
- 2. In the test project you want to run:
56
-
57
- ```bash
58
- npm i
59
- npm link @basaldev/frontend-starter-kit
60
- ```
61
-
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.