@alexandregme/zljs 0.3.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/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/chunk-WAQLH7A5.js +129 -0
- package/dist/index.d.ts +440 -0
- package/dist/index.js +1354 -0
- package/dist/next/index.d.ts +19 -0
- package/dist/next/index.js +50 -0
- package/dist/rhf/index.d.ts +25 -0
- package/dist/rhf/index.js +9 -0
- package/dist/styles.css +50 -0
- package/package.json +128 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Alexandre Mendes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# zljs — Enterprise Frontend Framework
|
|
2
|
+
|
|
3
|
+
A modern, TypeScript-based, open-source frontend framework for building scalable web applications.
|
|
4
|
+
|
|
5
|
+
## Packages
|
|
6
|
+
|
|
7
|
+
| Package | Description | Links |
|
|
8
|
+
| -------- | ------------------------------------------------------------ | ------------------------------------ |
|
|
9
|
+
| `core/` | Component library — Button, DataGrid, Forms, Modal, and more | [Storybook](https://zljs.vercel.app) |
|
|
10
|
+
| `agent/` | AI-powered UI generation agent | [README](./agent/README.md) |
|
|
11
|
+
|
|
12
|
+
## AI Roadmap
|
|
13
|
+
|
|
14
|
+
- [x] Conversational UI Generation (`agent/`)
|
|
15
|
+
- [ ] AI-Powered Testing Automation (via zl-quality-kit)
|
|
16
|
+
- [ ] Intelligent Component Recommendations
|
|
17
|
+
- [ ] Predictive Quality Gates
|
|
18
|
+
- [ ] Accessibility Validation via AI
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add @alexandregme/zljs
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Peer dependencies: `react@19`, `react-dom@19`, `next@>=16`, `next-auth@4`, `@reduxjs/toolkit@2`, `react-redux@9`.
|
|
27
|
+
|
|
28
|
+
Import the global styles once (e.g. in your root layout) and let Tailwind CSS v4 scan the library classes:
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
/* app/globals.css */
|
|
32
|
+
@import "tailwindcss";
|
|
33
|
+
@import "@alexandregme/zljs/styles.css";
|
|
34
|
+
@source "../node_modules/@alexandregme/zljs/dist";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Button } from "@alexandregme/zljs";
|
|
39
|
+
import { RootLayout } from "@alexandregme/zljs/next";
|
|
40
|
+
import { FormProvider, FormInput } from "@alexandregme/zljs/rhf";
|
|
41
|
+
|
|
42
|
+
<Button onClick={handleClick}>Submit</Button>;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Getting Started
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm install
|
|
49
|
+
pnpm storybook # Component library docs
|
|
50
|
+
pnpm agent:dev # AI agent
|
|
51
|
+
pnpm test # Run tests
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Tech Stack
|
|
55
|
+
|
|
56
|
+
TypeScript, React 19, Tailwind CSS v4, Storybook 10, Radix UI, pnpm workspaces, GitHub Actions, Vercel
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// core/rhf/form-provider/form-provider.tsx
|
|
4
|
+
import {
|
|
5
|
+
useForm,
|
|
6
|
+
FormProvider as RHFFormProvider
|
|
7
|
+
} from "react-hook-form";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var FormProvider = ({
|
|
10
|
+
children,
|
|
11
|
+
onSubmit,
|
|
12
|
+
defaultValues,
|
|
13
|
+
resolver
|
|
14
|
+
}) => {
|
|
15
|
+
const methods = useForm({
|
|
16
|
+
defaultValues,
|
|
17
|
+
resolver
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx(RHFFormProvider, { ...methods, children: /* @__PURE__ */ jsx("form", { onSubmit: methods.handleSubmit(onSubmit), children }) });
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// core/rhf/form-input/form-input.tsx
|
|
23
|
+
import { useFormContext } from "react-hook-form";
|
|
24
|
+
|
|
25
|
+
// core/forms/input/input.tsx
|
|
26
|
+
import { forwardRef, useId } from "react";
|
|
27
|
+
|
|
28
|
+
// core/forms/error/error.styles.ts
|
|
29
|
+
import { tv } from "tailwind-variants";
|
|
30
|
+
var error = tv({
|
|
31
|
+
base: "text-sm text-red-600"
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// core/forms/error/error.tsx
|
|
35
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
36
|
+
var Error = ({ message }) => {
|
|
37
|
+
if (!message) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ jsx2("span", { role: "alert", className: error(), children: message });
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// core/forms/input/input.styles.ts
|
|
44
|
+
import { tv as tv2 } from "tailwind-variants";
|
|
45
|
+
var wrapper = tv2({
|
|
46
|
+
base: "flex flex-col gap-1"
|
|
47
|
+
});
|
|
48
|
+
var label = tv2({
|
|
49
|
+
base: "text-sm font-medium text-gray-700"
|
|
50
|
+
});
|
|
51
|
+
var input = tv2({
|
|
52
|
+
base: "px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed"
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// core/forms/input/input.tsx
|
|
56
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
57
|
+
var Input = forwardRef(
|
|
58
|
+
({
|
|
59
|
+
label: labelText,
|
|
60
|
+
"aria-label": ariaLabel,
|
|
61
|
+
name,
|
|
62
|
+
type = "text",
|
|
63
|
+
placeholder,
|
|
64
|
+
value,
|
|
65
|
+
error: error2,
|
|
66
|
+
disabled,
|
|
67
|
+
onChange,
|
|
68
|
+
onBlur,
|
|
69
|
+
onKeyDown
|
|
70
|
+
}, ref) => {
|
|
71
|
+
const id = useId();
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", { className: wrapper(), children: [
|
|
73
|
+
labelText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: label(), children: labelText }),
|
|
74
|
+
/* @__PURE__ */ jsx3(
|
|
75
|
+
"input",
|
|
76
|
+
{
|
|
77
|
+
ref,
|
|
78
|
+
id,
|
|
79
|
+
name,
|
|
80
|
+
type,
|
|
81
|
+
placeholder,
|
|
82
|
+
value,
|
|
83
|
+
disabled,
|
|
84
|
+
onChange,
|
|
85
|
+
onBlur,
|
|
86
|
+
onKeyDown,
|
|
87
|
+
"aria-label": ariaLabel,
|
|
88
|
+
className: input()
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
error2 && /* @__PURE__ */ jsx3(Error, { message: error2 })
|
|
92
|
+
] });
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// core/rhf/form-input/form-input.tsx
|
|
97
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
98
|
+
var FormInput = ({
|
|
99
|
+
name,
|
|
100
|
+
label: label2,
|
|
101
|
+
type = "text",
|
|
102
|
+
placeholder,
|
|
103
|
+
disabled
|
|
104
|
+
}) => {
|
|
105
|
+
const {
|
|
106
|
+
register,
|
|
107
|
+
formState: { errors }
|
|
108
|
+
} = useFormContext();
|
|
109
|
+
const fieldError = errors[name];
|
|
110
|
+
const errorMessage = fieldError?.message;
|
|
111
|
+
return /* @__PURE__ */ jsx4(
|
|
112
|
+
Input,
|
|
113
|
+
{
|
|
114
|
+
label: label2,
|
|
115
|
+
type,
|
|
116
|
+
placeholder,
|
|
117
|
+
disabled,
|
|
118
|
+
error: errorMessage,
|
|
119
|
+
...register(name)
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
Error,
|
|
126
|
+
Input,
|
|
127
|
+
FormProvider,
|
|
128
|
+
FormInput
|
|
129
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ChangeEvent, FormEvent, FocusEvent, KeyboardEvent } from 'react';
|
|
3
|
+
export { FormInput, FormInputProps, FormProvider, FormProviderProps } from './rhf/index.js';
|
|
4
|
+
export { toast } from 'sonner';
|
|
5
|
+
import * as zustand from 'zustand';
|
|
6
|
+
import { Store, Reducer, Middleware, Dispatch } from '@reduxjs/toolkit';
|
|
7
|
+
import 'react-hook-form';
|
|
8
|
+
|
|
9
|
+
declare const iconNames: readonly ["Check", "X", "Plus", "Minus", "Search", "Menu", "ChevronDown", "ChevronUp", "ChevronLeft", "ChevronRight", "Pencil", "Trash2", "Save", "RefreshCw", "Home", "MessageSquare", "Users", "Store", "ShoppingCart", "BarChart3", "Brain", "Send", "LogOut", "User", "Key", "Contact", "Package", "Warehouse", "HandCoins", "Stethoscope", "LogIn", "Megaphone", "LayoutDashboard", "Smile", "Frown", "Cat", "ArrowRight", "Loader", "CheckCircle", "XCircle", "AlertTriangle", "Info", "Map", "CloudDownload", "Wrench", "GitMerge", "SiWhatsapp", "SiFacebook", "SiInstagram", "SiShopify"];
|
|
10
|
+
|
|
11
|
+
type IconName = (typeof iconNames)[number];
|
|
12
|
+
interface IconProps {
|
|
13
|
+
name: IconName;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Semantic colors for action-oriented components (Button, Heading, etc.)
|
|
18
|
+
*/
|
|
19
|
+
type SemanticColor = "primary" | "success" | "danger" | "warning" | "info" | "none";
|
|
20
|
+
/**
|
|
21
|
+
* Literal colors for data visualization components (StatsCard, etc.)
|
|
22
|
+
*/
|
|
23
|
+
type DataColor = "blue" | "red" | "yellow" | "green" | "gray" | "orange";
|
|
24
|
+
|
|
25
|
+
type ButtonVariant = "default" | "icon" | "ghost" | "link";
|
|
26
|
+
interface ButtonProps {
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
type?: "button" | "submit" | "reset";
|
|
29
|
+
variant?: ButtonVariant;
|
|
30
|
+
color?: SemanticColor;
|
|
31
|
+
icon?: IconName;
|
|
32
|
+
iconPosition?: "left" | "right";
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
"aria-label"?: string;
|
|
35
|
+
onClick?: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const Button: ({ children, type, variant: variantProp, color, icon, iconPosition, disabled, "aria-label": ariaLabel, onClick, }: ButtonProps) => react.JSX.Element;
|
|
39
|
+
|
|
40
|
+
interface DataGridCellParams<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
41
|
+
value?: any;
|
|
42
|
+
data?: T;
|
|
43
|
+
}
|
|
44
|
+
interface DataGridColumn<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
45
|
+
field: string;
|
|
46
|
+
headerName: string;
|
|
47
|
+
cellRenderer?: (params: DataGridCellParams<T>) => ReactNode;
|
|
48
|
+
pinned?: "left" | "right";
|
|
49
|
+
filter?: boolean;
|
|
50
|
+
width?: number;
|
|
51
|
+
cellStyle?: (params: DataGridCellParams<T>) => Record<string, string | number | undefined> | undefined;
|
|
52
|
+
valueFormatter?: (params: DataGridCellParams<T>) => string;
|
|
53
|
+
}
|
|
54
|
+
interface DataGridProps<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
55
|
+
columns: DataGridColumn<T>[];
|
|
56
|
+
data: T[];
|
|
57
|
+
showSearch?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const DataGrid: <T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, showSearch, }: DataGridProps<T>) => react.JSX.Element;
|
|
61
|
+
|
|
62
|
+
interface CheckboxProps {
|
|
63
|
+
label: string;
|
|
64
|
+
checked?: boolean;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
error?: string;
|
|
67
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare const Checkbox: ({ label: labelText, checked, disabled, error, onChange, }: CheckboxProps) => react.JSX.Element;
|
|
71
|
+
|
|
72
|
+
interface ErrorProps {
|
|
73
|
+
message: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare const Error: ({ message }: ErrorProps) => react.JSX.Element | null;
|
|
77
|
+
|
|
78
|
+
interface FormProps {
|
|
79
|
+
children: ReactNode;
|
|
80
|
+
onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare const Form: ({ children, onSubmit, disabled }: FormProps) => react.JSX.Element;
|
|
85
|
+
|
|
86
|
+
interface InputProps {
|
|
87
|
+
label?: string;
|
|
88
|
+
"aria-label"?: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
type?: "text" | "password" | "email";
|
|
91
|
+
placeholder?: string;
|
|
92
|
+
value?: string;
|
|
93
|
+
error?: string;
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
96
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
97
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
101
|
+
|
|
102
|
+
interface RadioProps {
|
|
103
|
+
label: string;
|
|
104
|
+
name: string;
|
|
105
|
+
value: string;
|
|
106
|
+
checked?: boolean;
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare const Radio: ({ label: labelText, name, value, checked, disabled, onChange, }: RadioProps) => react.JSX.Element;
|
|
112
|
+
|
|
113
|
+
interface SelectOption {
|
|
114
|
+
value: string;
|
|
115
|
+
label: string;
|
|
116
|
+
}
|
|
117
|
+
interface SelectProps {
|
|
118
|
+
label: string;
|
|
119
|
+
options: SelectOption[];
|
|
120
|
+
value?: string;
|
|
121
|
+
placeholder?: string;
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
error?: string;
|
|
124
|
+
onChange?: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare const Select: ({ label: labelText, options, value, placeholder, disabled, error, onChange, }: SelectProps) => react.JSX.Element;
|
|
128
|
+
|
|
129
|
+
interface TextAreaProps {
|
|
130
|
+
label: string;
|
|
131
|
+
placeholder?: string;
|
|
132
|
+
value?: string;
|
|
133
|
+
rows?: number;
|
|
134
|
+
error?: string;
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare const TextArea: ({ label: labelText, placeholder, value, rows, error, disabled, onChange, }: TextAreaProps) => react.JSX.Element;
|
|
140
|
+
|
|
141
|
+
declare const Icon: ({ name }: IconProps) => react.JSX.Element;
|
|
142
|
+
|
|
143
|
+
interface StatsCardProps {
|
|
144
|
+
label: string;
|
|
145
|
+
value: string | number;
|
|
146
|
+
color: DataColor;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare const StatsCard: ({ label, value, color }: StatsCardProps) => react.JSX.Element;
|
|
150
|
+
|
|
151
|
+
type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
152
|
+
interface ModalProps {
|
|
153
|
+
open: boolean;
|
|
154
|
+
onClose: () => void;
|
|
155
|
+
title: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
children?: ReactNode;
|
|
158
|
+
size?: ModalSize;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare const Modal: ({ open, onClose, title, description, children, size, }: ModalProps) => react.JSX.Element;
|
|
162
|
+
|
|
163
|
+
interface WhatsAppButtonProps {
|
|
164
|
+
phone: string;
|
|
165
|
+
message?: string;
|
|
166
|
+
children?: string;
|
|
167
|
+
onClick?: () => void;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
declare const WhatsAppButton: ({ phone, message, children, onClick, }: WhatsAppButtonProps) => react.JSX.Element;
|
|
171
|
+
|
|
172
|
+
interface HeadingProps {
|
|
173
|
+
children: ReactNode;
|
|
174
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
175
|
+
color?: SemanticColor;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare const Heading: ({ children, level, color }: HeadingProps) => react.JSX.Element;
|
|
179
|
+
|
|
180
|
+
interface SidebarItem {
|
|
181
|
+
icon: IconName;
|
|
182
|
+
label: string;
|
|
183
|
+
href: string;
|
|
184
|
+
}
|
|
185
|
+
interface SidebarSection {
|
|
186
|
+
items: SidebarItem[];
|
|
187
|
+
}
|
|
188
|
+
interface SidebarUser {
|
|
189
|
+
name: string;
|
|
190
|
+
email: string;
|
|
191
|
+
}
|
|
192
|
+
interface SidebarProps {
|
|
193
|
+
sections: SidebarSection[];
|
|
194
|
+
user: SidebarUser;
|
|
195
|
+
activeHref?: string;
|
|
196
|
+
defaultCollapsed?: boolean;
|
|
197
|
+
collapseLabel: string;
|
|
198
|
+
homeHref?: string | false;
|
|
199
|
+
homeLabel?: string;
|
|
200
|
+
onLogout: () => void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, homeHref, homeLabel, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
204
|
+
|
|
205
|
+
interface TagProps {
|
|
206
|
+
children: ReactNode;
|
|
207
|
+
color?: "blue" | "green" | "red" | "yellow" | "gray";
|
|
208
|
+
onRemove?: () => void;
|
|
209
|
+
className?: string;
|
|
210
|
+
}
|
|
211
|
+
declare const Tag: ({ children, color, onRemove, className, }: TagProps) => react.JSX.Element;
|
|
212
|
+
|
|
213
|
+
declare const Toaster: () => react.JSX.Element;
|
|
214
|
+
|
|
215
|
+
interface AppState {
|
|
216
|
+
fetchingCalls: number;
|
|
217
|
+
fetching: boolean;
|
|
218
|
+
startFetching: () => void;
|
|
219
|
+
finishFetching: () => void;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
declare const useAppStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppState>, "setState" | "devtools"> & {
|
|
223
|
+
setState(partial: AppState | Partial<AppState> | ((state: AppState) => AppState | Partial<AppState>), replace?: false | undefined, action?: (string | {
|
|
224
|
+
[x: string]: unknown;
|
|
225
|
+
[x: number]: unknown;
|
|
226
|
+
[x: symbol]: unknown;
|
|
227
|
+
type: string;
|
|
228
|
+
}) | undefined): void;
|
|
229
|
+
setState(state: AppState | ((state: AppState) => AppState), replace: true, action?: (string | {
|
|
230
|
+
[x: string]: unknown;
|
|
231
|
+
[x: number]: unknown;
|
|
232
|
+
[x: symbol]: unknown;
|
|
233
|
+
type: string;
|
|
234
|
+
}) | undefined): void;
|
|
235
|
+
devtools: {
|
|
236
|
+
cleanup: () => void;
|
|
237
|
+
};
|
|
238
|
+
}>;
|
|
239
|
+
|
|
240
|
+
type ToastType = "success" | "error" | "info" | "warning";
|
|
241
|
+
interface Toast {
|
|
242
|
+
id: number;
|
|
243
|
+
message: string;
|
|
244
|
+
type: ToastType;
|
|
245
|
+
}
|
|
246
|
+
interface ToastState {
|
|
247
|
+
toasts: Toast[];
|
|
248
|
+
addToast: (message: string, type?: ToastType) => number;
|
|
249
|
+
removeToast: (id: number) => void;
|
|
250
|
+
success: (message: string) => number;
|
|
251
|
+
error: (message: string) => number;
|
|
252
|
+
info: (message: string) => number;
|
|
253
|
+
warning: (message: string) => number;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare const useToastStore: zustand.UseBoundStore<Omit<zustand.StoreApi<ToastState>, "setState" | "devtools"> & {
|
|
257
|
+
setState(partial: ToastState | Partial<ToastState> | ((state: ToastState) => ToastState | Partial<ToastState>), replace?: false | undefined, action?: (string | {
|
|
258
|
+
[x: string]: unknown;
|
|
259
|
+
[x: number]: unknown;
|
|
260
|
+
[x: symbol]: unknown;
|
|
261
|
+
type: string;
|
|
262
|
+
}) | undefined): void;
|
|
263
|
+
setState(state: ToastState | ((state: ToastState) => ToastState), replace: true, action?: (string | {
|
|
264
|
+
[x: string]: unknown;
|
|
265
|
+
[x: number]: unknown;
|
|
266
|
+
[x: symbol]: unknown;
|
|
267
|
+
type: string;
|
|
268
|
+
}) | undefined): void;
|
|
269
|
+
devtools: {
|
|
270
|
+
cleanup: () => void;
|
|
271
|
+
};
|
|
272
|
+
}>;
|
|
273
|
+
|
|
274
|
+
interface ModalEntry {
|
|
275
|
+
name: string;
|
|
276
|
+
payload?: unknown;
|
|
277
|
+
}
|
|
278
|
+
interface ModalState {
|
|
279
|
+
modals: ModalEntry[];
|
|
280
|
+
openModal: (name: string) => void;
|
|
281
|
+
openModalWithPayload: (name: string, payload: unknown) => void;
|
|
282
|
+
closeModal: (name: string) => void;
|
|
283
|
+
isOpen: (name: string) => boolean;
|
|
284
|
+
getPayload: (name: string) => unknown | undefined;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare const useModalStore: zustand.UseBoundStore<Omit<zustand.StoreApi<ModalState>, "setState" | "devtools"> & {
|
|
288
|
+
setState(partial: ModalState | Partial<ModalState> | ((state: ModalState) => ModalState | Partial<ModalState>), replace?: false | undefined, action?: (string | {
|
|
289
|
+
[x: string]: unknown;
|
|
290
|
+
[x: number]: unknown;
|
|
291
|
+
[x: symbol]: unknown;
|
|
292
|
+
type: string;
|
|
293
|
+
}) | undefined): void;
|
|
294
|
+
setState(state: ModalState | ((state: ModalState) => ModalState), replace: true, action?: (string | {
|
|
295
|
+
[x: string]: unknown;
|
|
296
|
+
[x: number]: unknown;
|
|
297
|
+
[x: symbol]: unknown;
|
|
298
|
+
type: string;
|
|
299
|
+
}) | undefined): void;
|
|
300
|
+
devtools: {
|
|
301
|
+
cleanup: () => void;
|
|
302
|
+
};
|
|
303
|
+
}>;
|
|
304
|
+
|
|
305
|
+
interface ExtendedStore extends Store {
|
|
306
|
+
setDynamicReducers?: (reducers: Record<string, Reducer>) => void;
|
|
307
|
+
}
|
|
308
|
+
interface GlobalStateProps {
|
|
309
|
+
children: ReactNode;
|
|
310
|
+
reducers?: Record<string, Reducer>;
|
|
311
|
+
middlewares?: Middleware[];
|
|
312
|
+
preloadedState?: Record<string, unknown>;
|
|
313
|
+
coreReducers?: Record<string, Reducer>;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const GlobalState: ({ children, reducers, middlewares, preloadedState, coreReducers, }: GlobalStateProps) => react.JSX.Element;
|
|
317
|
+
|
|
318
|
+
interface RouterState {
|
|
319
|
+
urlAsPath: string;
|
|
320
|
+
query: Record<string, string>;
|
|
321
|
+
setRoute: (urlAsPath: string) => void;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
declare const useRouterStore: zustand.UseBoundStore<Omit<zustand.StoreApi<RouterState>, "setState" | "devtools"> & {
|
|
325
|
+
setState(partial: RouterState | Partial<RouterState> | ((state: RouterState) => RouterState | Partial<RouterState>), replace?: false | undefined, action?: (string | {
|
|
326
|
+
[x: string]: unknown;
|
|
327
|
+
[x: number]: unknown;
|
|
328
|
+
[x: symbol]: unknown;
|
|
329
|
+
type: string;
|
|
330
|
+
}) | undefined): void;
|
|
331
|
+
setState(state: RouterState | ((state: RouterState) => RouterState), replace: true, action?: (string | {
|
|
332
|
+
[x: string]: unknown;
|
|
333
|
+
[x: number]: unknown;
|
|
334
|
+
[x: symbol]: unknown;
|
|
335
|
+
type: string;
|
|
336
|
+
}) | undefined): void;
|
|
337
|
+
devtools: {
|
|
338
|
+
cleanup: () => void;
|
|
339
|
+
};
|
|
340
|
+
}>;
|
|
341
|
+
|
|
342
|
+
declare const splitURLasPath: (urlAsPath: string) => Record<string, string>;
|
|
343
|
+
|
|
344
|
+
interface PageState {
|
|
345
|
+
title: string;
|
|
346
|
+
setTitle: (title: string) => void;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare const usePageStore: zustand.UseBoundStore<Omit<zustand.StoreApi<PageState>, "setState" | "devtools"> & {
|
|
350
|
+
setState(partial: PageState | Partial<PageState> | ((state: PageState) => PageState | Partial<PageState>), replace?: false | undefined, action?: (string | {
|
|
351
|
+
[x: string]: unknown;
|
|
352
|
+
[x: number]: unknown;
|
|
353
|
+
[x: symbol]: unknown;
|
|
354
|
+
type: string;
|
|
355
|
+
}) | undefined): void;
|
|
356
|
+
setState(state: PageState | ((state: PageState) => PageState), replace: true, action?: (string | {
|
|
357
|
+
[x: string]: unknown;
|
|
358
|
+
[x: number]: unknown;
|
|
359
|
+
[x: symbol]: unknown;
|
|
360
|
+
type: string;
|
|
361
|
+
}) | undefined): void;
|
|
362
|
+
devtools: {
|
|
363
|
+
cleanup: () => void;
|
|
364
|
+
};
|
|
365
|
+
}>;
|
|
366
|
+
|
|
367
|
+
type InitPageFunction = (dispatch: Dispatch) => void;
|
|
368
|
+
interface PageWrapperProps {
|
|
369
|
+
title: string;
|
|
370
|
+
children?: ReactNode;
|
|
371
|
+
reducers?: Record<string, Reducer>;
|
|
372
|
+
initPage?: InitPageFunction;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
declare const PageWrapper: ({ reducers, title, initPage, children, }: PageWrapperProps) => react.JSX.Element;
|
|
376
|
+
|
|
377
|
+
interface ConnectedModalProps {
|
|
378
|
+
modalId: string;
|
|
379
|
+
title: string;
|
|
380
|
+
description?: string;
|
|
381
|
+
size?: ModalSize;
|
|
382
|
+
children?: ReactNode;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
declare const ConnectedModal: ({ modalId, title, description, size, children, }: ConnectedModalProps) => react.JSX.Element;
|
|
386
|
+
|
|
387
|
+
interface SpinnerProps {
|
|
388
|
+
className?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
declare const Spinner: ({ className }: SpinnerProps) => react.JSX.Element;
|
|
392
|
+
|
|
393
|
+
interface LoaderProps {
|
|
394
|
+
label?: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
declare const Loader: ({ label }: LoaderProps) => react.JSX.Element | null;
|
|
398
|
+
|
|
399
|
+
interface AppWrapperProps {
|
|
400
|
+
children: ReactNode;
|
|
401
|
+
reducers?: Record<string, Reducer>;
|
|
402
|
+
middlewares?: Middleware[];
|
|
403
|
+
coreReducers?: Record<string, Reducer>;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
declare const AppWrapper: ({ children, reducers, middlewares, coreReducers, }: AppWrapperProps) => react.JSX.Element;
|
|
407
|
+
|
|
408
|
+
interface DocumentWrapperProps {
|
|
409
|
+
children: ReactNode;
|
|
410
|
+
lang?: string;
|
|
411
|
+
className?: string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
declare const DocumentWrapper: ({ children, lang, className, }: DocumentWrapperProps) => react.JSX.Element;
|
|
415
|
+
|
|
416
|
+
interface HttpClientConfig {
|
|
417
|
+
baseUrl?: string;
|
|
418
|
+
headers?: Record<string, string>;
|
|
419
|
+
}
|
|
420
|
+
interface HttpRequestConfig {
|
|
421
|
+
payload?: FormData | object;
|
|
422
|
+
params?: object;
|
|
423
|
+
headers?: Record<string, string>;
|
|
424
|
+
silent?: boolean;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
declare class HTTPClient {
|
|
428
|
+
baseUrl: string;
|
|
429
|
+
headers: Record<string, string>;
|
|
430
|
+
constructor(config?: HttpClientConfig);
|
|
431
|
+
private request;
|
|
432
|
+
get<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
|
|
433
|
+
post<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
|
|
434
|
+
put<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
|
|
435
|
+
delete<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
|
|
436
|
+
patch<T = unknown>(url: string, config?: HttpRequestConfig): Promise<T | undefined>;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export { AppWrapper, Button, Checkbox, ConnectedModal, DataGrid, DocumentWrapper, Error, Form, GlobalState, HTTPClient, Heading, Icon, Input, Loader, Modal, PageWrapper, Radio, Select, Sidebar, Spinner, StatsCard, Tag, TextArea, Toaster, WhatsAppButton, splitURLasPath, useAppStore, useModalStore, usePageStore, useRouterStore, useToastStore };
|
|
440
|
+
export type { AppState, AppWrapperProps, ButtonProps, ButtonVariant, CheckboxProps, ConnectedModalProps, DataGridColumn, DataGridProps, DocumentWrapperProps, ErrorProps, ExtendedStore, FormProps, GlobalStateProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, InitPageFunction, InputProps, LoaderProps, ModalEntry, ModalProps, ModalState, PageState, PageWrapperProps, RadioProps, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, SpinnerProps, StatsCardProps, TagProps, TextAreaProps, Toast, ToastState, ToastType, WhatsAppButtonProps };
|