dgz-ui-shared 1.1.24 → 1.1.26
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 +236 -31
- package/dist/Actions-DYmkv_J9.js +29 -0
- package/dist/Actions-Dh8TPahn.cjs +1 -0
- package/dist/ExportData-DV3HcBlK.cjs +1 -0
- package/dist/ExportData-DvwQ6UCI.js +31 -0
- package/dist/{FilterWrapper-Dk18nVPy.js → FilterWrapper-CRF1U7yO.js} +63 -56
- package/dist/FilterWrapper-uGnbHc44.cjs +21 -0
- package/dist/components/actions/index.cjs.js +1 -1
- package/dist/components/actions/index.es.js +1 -1
- package/dist/components/datatable/index.cjs.js +5 -5
- package/dist/components/datatable/index.es.js +249 -219
- package/dist/components/export/index.cjs.js +1 -1
- package/dist/components/export/index.es.js +1 -1
- package/dist/components/filters/index.cjs.js +1 -1
- package/dist/components/filters/index.es.js +23 -22
- package/dist/dgz-ui-shared.css +1 -1
- package/dist/types/components/actions/Actions.d.ts +14 -2
- package/dist/types/components/actions/Actions.d.ts.map +1 -1
- package/dist/types/components/confirm/Confirm.d.ts +7 -0
- package/dist/types/components/confirm/Confirm.d.ts.map +1 -1
- package/dist/types/components/confirm/PasswordConfirm.d.ts +4 -0
- package/dist/types/components/confirm/PasswordConfirm.d.ts.map +1 -1
- package/dist/types/components/datatable/DataTable.d.ts +44 -4
- package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
- package/dist/types/components/datatable/MyTable.d.ts +19 -2
- package/dist/types/components/datatable/MyTable.d.ts.map +1 -1
- package/dist/types/components/datepicker/DateRangePicker.d.ts +9 -0
- package/dist/types/components/datepicker/DateRangePicker.d.ts.map +1 -1
- package/dist/types/components/export/ExportData.d.ts +5 -2
- package/dist/types/components/export/ExportData.d.ts.map +1 -1
- package/dist/types/components/filters/FilterWrapper.d.ts +25 -1
- package/dist/types/components/filters/FilterWrapper.d.ts.map +1 -1
- package/dist/types/components/filters/Search.d.ts +7 -0
- package/dist/types/components/filters/Search.d.ts.map +1 -1
- package/dist/types/components/filters/SearchWithCtrl.d.ts +6 -1
- package/dist/types/components/filters/SearchWithCtrl.d.ts.map +1 -1
- package/dist/types/components/form/MyCheckbox.d.ts +4 -0
- package/dist/types/components/form/MyCheckbox.d.ts.map +1 -1
- package/dist/types/components/form/MyDatePicker.d.ts +5 -0
- package/dist/types/components/form/MyDatePicker.d.ts.map +1 -1
- package/dist/types/components/form/MyDateRangePicker.d.ts +5 -0
- package/dist/types/components/form/MyDateRangePicker.d.ts.map +1 -1
- package/dist/types/components/form/MyHtmlEditor.d.ts +5 -0
- package/dist/types/components/form/MyHtmlEditor.d.ts.map +1 -1
- package/dist/types/components/form/MyInput.d.ts +4 -0
- package/dist/types/components/form/MyInput.d.ts.map +1 -1
- package/dist/types/components/form/MyMaskInput.d.ts +5 -0
- package/dist/types/components/form/MyMaskInput.d.ts.map +1 -1
- package/dist/types/components/form/MyRadio.d.ts +4 -0
- package/dist/types/components/form/MyRadio.d.ts.map +1 -1
- package/dist/types/components/form/MySelect.d.ts +5 -0
- package/dist/types/components/form/MySelect.d.ts.map +1 -1
- package/dist/types/components/form/MySwitch.d.ts +4 -0
- package/dist/types/components/form/MySwitch.d.ts.map +1 -1
- package/dist/types/components/form/MyTextarea.d.ts +4 -0
- package/dist/types/components/form/MyTextarea.d.ts.map +1 -1
- package/dist/types/components/form/MyTimePicker.d.ts +6 -0
- package/dist/types/components/form/MyTimePicker.d.ts.map +1 -1
- package/dist/types/components/gallery/MyGallery.d.ts +22 -0
- package/dist/types/components/gallery/MyGallery.d.ts.map +1 -1
- package/dist/types/components/modal/MyModal.d.ts +9 -0
- package/dist/types/components/modal/MyModal.d.ts.map +1 -1
- package/dist/types/components/pagination/MyLimitSelect.d.ts +6 -0
- package/dist/types/components/pagination/MyLimitSelect.d.ts.map +1 -1
- package/dist/types/components/pagination/MyPagination.d.ts +6 -0
- package/dist/types/components/pagination/MyPagination.d.ts.map +1 -1
- package/dist/types/components/tooltip/MyTooltip.d.ts +6 -0
- package/dist/types/components/tooltip/MyTooltip.d.ts.map +1 -1
- package/dist/types/contexts/ThemeProviderContext.d.ts +5 -0
- package/dist/types/contexts/ThemeProviderContext.d.ts.map +1 -1
- package/dist/types/enums/ThemeMode.d.ts +3 -0
- package/dist/types/enums/ThemeMode.d.ts.map +1 -1
- package/dist/types/hooks/useColumns.d.ts +6 -0
- package/dist/types/hooks/useColumns.d.ts.map +1 -1
- package/dist/types/hooks/useDataTable.d.ts +6 -0
- package/dist/types/hooks/useDataTable.d.ts.map +1 -1
- package/dist/types/hooks/useFilter.d.ts +11 -0
- package/dist/types/hooks/useFilter.d.ts.map +1 -1
- package/dist/types/providers/ThemeProvider.d.ts +14 -0
- package/dist/types/providers/ThemeProvider.d.ts.map +1 -1
- package/dist/types/schemas/createConfirmPasswordSchema.d.ts +9 -0
- package/dist/types/schemas/createConfirmPasswordSchema.d.ts.map +1 -1
- package/dist/types/stores/useColumnsStore.d.ts +8 -0
- package/dist/types/stores/useColumnsStore.d.ts.map +1 -1
- package/dist/types/stores/useDateRangeStore.d.ts +8 -0
- package/dist/types/stores/useDateRangeStore.d.ts.map +1 -1
- package/dist/types/types/column.type.d.ts +15 -0
- package/dist/types/types/column.type.d.ts.map +1 -1
- package/dist/types/types/translation-args.type.d.ts +3 -0
- package/dist/types/types/translation-args.type.d.ts.map +1 -1
- package/dist/types/utils/day.d.ts +4 -0
- package/dist/types/utils/day.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/Actions-CKVu3P3q.js +0 -28
- package/dist/Actions-uGf1oq7E.cjs +0 -1
- package/dist/ExportData-1xS2UAoq.js +0 -29
- package/dist/ExportData-ApStkEWC.cjs +0 -1
- package/dist/FilterWrapper-DvNjUQih.cjs +0 -21
package/README.md
CHANGED
|
@@ -1,31 +1,236 @@
|
|
|
1
|
-
-
|
|
2
|
-
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
# dgz-ui-shared
|
|
2
|
+
|
|
3
|
+
A robust, shared UI library built for React applications using TypeScript, Tailwind CSS, and `dgz-ui`. This library provides a collection of high-level components, hooks, and utilities to streamline development, featuring advanced data tables, form integrations, and responsive design patterns.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Advanced Data Table**: A feature-rich table component with server-side pagination, sorting, filtering, searching, column visibility management, and export capabilities.
|
|
8
|
+
- **Form Components**: Wrappers for common form inputs (`Input`, `Select`, `DatePicker`, `Checkbox`, etc.) seamlessly integrated with `react-hook-form` and `zod` validation.
|
|
9
|
+
- **Confirmation Dialogs**: Promise-based confirmation modals (including password confirmation) via the `useConfirm` hook.
|
|
10
|
+
- **UI Patterns**: Ready-to-use components for Modals, Galleries, Tooltips, and Loaders.
|
|
11
|
+
- **Theming**: Built-in dark/light mode support with `ThemeProvider` and `ThemeToggle`.
|
|
12
|
+
- **Responsive Utilities**: Hooks for managing media queries and responsive layouts.
|
|
13
|
+
- **Internationalization**: Built with `i18next` support for easy localization.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the package via npm:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install dgz-ui-shared
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Ensure you have the required peer dependencies installed:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install react react-dom dayjs
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Setup
|
|
30
|
+
|
|
31
|
+
### 1. Import Styles
|
|
32
|
+
|
|
33
|
+
Import the library's CSS in your main entry file (e.g., `main.tsx` or `App.tsx`):
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import 'dgz-ui-shared/dist/dgz-ui-shared.css';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Theme Provider
|
|
40
|
+
|
|
41
|
+
Wrap your application with the `ThemeProvider` to enable theme management:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { ThemeProvider } from 'dgz-ui-shared/providers';
|
|
45
|
+
|
|
46
|
+
function App() {
|
|
47
|
+
return (
|
|
48
|
+
<ThemeProvider defaultTheme="system" storageKey="vite-ui-theme">
|
|
49
|
+
<YourApp />
|
|
50
|
+
</ThemeProvider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage Examples
|
|
56
|
+
|
|
57
|
+
### Data Table
|
|
58
|
+
|
|
59
|
+
The `DataTable` component is the centerpiece of this library. It handles complex data presentation needs with minimal boilerplate.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { DataTable } from 'dgz-ui-shared/components/datatable';
|
|
63
|
+
import { useDataTable } from 'dgz-ui-shared/hooks';
|
|
64
|
+
|
|
65
|
+
const MyUserTable = () => {
|
|
66
|
+
// Define columns
|
|
67
|
+
const columns = [
|
|
68
|
+
{ key: 'name', dataIndex: 'name', name: 'Name', sortable: true },
|
|
69
|
+
{ key: 'email', dataIndex: 'email', name: 'Email' },
|
|
70
|
+
{ key: 'role', dataIndex: 'role', name: 'Role' },
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
// Example data source (usually from an API)
|
|
74
|
+
const dataSource = {
|
|
75
|
+
docs: [
|
|
76
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin' },
|
|
77
|
+
// ... more data
|
|
78
|
+
],
|
|
79
|
+
page: 1,
|
|
80
|
+
limit: 10,
|
|
81
|
+
totalPages: 5,
|
|
82
|
+
total: 50,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handleParamChange = (params) => {
|
|
86
|
+
console.log('Fetch new data with:', params);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<DataTable
|
|
91
|
+
tableKey="user-table"
|
|
92
|
+
rowKey="id"
|
|
93
|
+
columns={columns}
|
|
94
|
+
dataSource={dataSource}
|
|
95
|
+
onParamChange={handleParamChange}
|
|
96
|
+
hasPagination
|
|
97
|
+
hasSearch
|
|
98
|
+
hasColumnsVisibilityDropdown
|
|
99
|
+
hasCheckbox
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Form Components
|
|
106
|
+
|
|
107
|
+
Use the `My*` form components to build accessible, validated forms with `react-hook-form`.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { useForm } from 'react-hook-form';
|
|
111
|
+
import { MyInput, MySelect } from 'dgz-ui-shared/components/form';
|
|
112
|
+
import { Button } from 'dgz-ui/button'; // Assuming you have base UI components
|
|
113
|
+
|
|
114
|
+
const SignUpForm = () => {
|
|
115
|
+
const { control, handleSubmit } = useForm();
|
|
116
|
+
|
|
117
|
+
const onSubmit = (data) => console.log(data);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
|
|
121
|
+
<MyInput
|
|
122
|
+
control={control}
|
|
123
|
+
name="username"
|
|
124
|
+
label="Username"
|
|
125
|
+
required
|
|
126
|
+
placeholder="Enter your username"
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
<MySelect
|
|
130
|
+
control={control}
|
|
131
|
+
name="role"
|
|
132
|
+
label="Role"
|
|
133
|
+
options={[
|
|
134
|
+
{ value: 'admin', label: 'Admin' },
|
|
135
|
+
{ value: 'user', label: 'User' },
|
|
136
|
+
]}
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<Button type="submit">Submit</Button>
|
|
140
|
+
</form>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Confirmation Dialogs
|
|
146
|
+
|
|
147
|
+
Trigger confirmation modals programmatically using `useConfirm`.
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { useConfirm } from 'dgz-ui-shared/hooks';
|
|
151
|
+
import { Button } from 'dgz-ui/button';
|
|
152
|
+
|
|
153
|
+
const DeleteButton = () => {
|
|
154
|
+
const { confirm } = useConfirm();
|
|
155
|
+
|
|
156
|
+
const handleDelete = () => {
|
|
157
|
+
confirm({
|
|
158
|
+
onConfirm: () => {
|
|
159
|
+
console.log('Item deleted!');
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return <Button onClick={handleDelete}>Delete Item</Button>;
|
|
165
|
+
};
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Image Gallery
|
|
169
|
+
|
|
170
|
+
Display a responsive grid of images with a fullscreen viewer.
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { MyGallery } from 'dgz-ui-shared/components/gallery';
|
|
174
|
+
|
|
175
|
+
const images = [
|
|
176
|
+
{
|
|
177
|
+
id: '1',
|
|
178
|
+
src: 'https://example.com/large.jpg',
|
|
179
|
+
thumbnail: 'https://example.com/thumb.jpg',
|
|
180
|
+
alt: 'Example Image',
|
|
181
|
+
title: 'Beautiful Scenery',
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
const GalleryPage = () => {
|
|
186
|
+
return <MyGallery images={images} hasInfo />;
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Available Components
|
|
191
|
+
|
|
192
|
+
| Category | Components |
|
|
193
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
194
|
+
| **Data Display** | `DataTable`, `MyTable`, `MyGallery` |
|
|
195
|
+
| **Form** | `MyInput`, `MySelect`, `MyCheckbox`, `MyRadio`, `MySwitch`, `MyTextarea`, `MyDatePicker`, `MyDateRangePicker`, `MyTimePicker`, `MyHtmlEditor`, `MyMaskInput` |
|
|
196
|
+
| **Feedback** | `Loader`, `Spin`, `Empty` |
|
|
197
|
+
| **Overlays** | `MyModal`, `Confirm`, `PasswordConfirm`, `MyTooltip` |
|
|
198
|
+
| **Navigation** | `MyPagination`, `MyLimitSelect` |
|
|
199
|
+
| **Utils** | `ThemeToggle`, `ExportData`, `FilterWrapper`, `Search` |
|
|
200
|
+
|
|
201
|
+
## Hooks
|
|
202
|
+
|
|
203
|
+
| Hook | Description |
|
|
204
|
+
| -------------------- | ---------------------------------------------------- |
|
|
205
|
+
| `useDataTable` | Manages row selection and table state. |
|
|
206
|
+
| `useColumns` | Manages column visibility and persistence. |
|
|
207
|
+
| `useConfirm` | Provides imperative API for confirmation dialogs. |
|
|
208
|
+
| `useTheme` | Access and toggle current theme (light/dark/system). |
|
|
209
|
+
| `useFilter` | Syncs filter state with URL parameters or form. |
|
|
210
|
+
| `useMediaQuerySizes` | Responsive breakpoints helpers. |
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
Clone the repository and install dependencies:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
git clone https://github.com/Alisher1119/dgz-ui-shared.git
|
|
218
|
+
cd dgz-ui-shared
|
|
219
|
+
npm install
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Available Scripts
|
|
223
|
+
|
|
224
|
+
- `npm run dev`: Start the development server (Vite).
|
|
225
|
+
- `npm run build`: Build the library for production.
|
|
226
|
+
- `npm run lint`: Lint the codebase.
|
|
227
|
+
- `npm run format`: Format code with Prettier.
|
|
228
|
+
- `npm run test`: Run tests with Vitest.
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
233
|
+
|
|
234
|
+
## Author
|
|
235
|
+
|
|
236
|
+
[Alisher Khayrillaev](https://github.com/Alisher1119)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { j as s } from "./jsx-runtime-DS1N_tNq.js";
|
|
2
|
+
import { T as t, A as o, i as m, u as c } from "./dropdown-menu-TWRSm6RK-D_FJpI4C.js";
|
|
3
|
+
import { u as d } from "./button-CdZDBhmr-BT_j3ig5.js";
|
|
4
|
+
import { W as x, f as j } from "./index-BrQ82Wyu.js";
|
|
5
|
+
const A = ({
|
|
6
|
+
actions: i,
|
|
7
|
+
triggerProps: n,
|
|
8
|
+
contentProps: a,
|
|
9
|
+
title: e
|
|
10
|
+
}) => /* @__PURE__ */ s.jsxs(t, { children: [
|
|
11
|
+
/* @__PURE__ */ s.jsx(o, { asChild: !0, ...n, children: /* @__PURE__ */ s.jsxs(
|
|
12
|
+
d,
|
|
13
|
+
{
|
|
14
|
+
variant: "secondary",
|
|
15
|
+
size: "sm",
|
|
16
|
+
className: "ml-auto rounded-lg px-3",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ s.jsx(x, {}),
|
|
19
|
+
" ",
|
|
20
|
+
/* @__PURE__ */ s.jsx("span", { className: "hidden lg:!inline", children: e || "Actions" }),
|
|
21
|
+
/* @__PURE__ */ s.jsx(j, {})
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
) }),
|
|
25
|
+
/* @__PURE__ */ s.jsx(m, { align: "end", ...a, children: i.map((r, l) => /* @__PURE__ */ s.jsx(c, { onClick: () => r.onClick(), children: r.label }, l)) })
|
|
26
|
+
] });
|
|
27
|
+
export {
|
|
28
|
+
A
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-h4oGeKUK.cjs"),n=require("./dropdown-menu-TWRSm6RK-DQ03CnVw.cjs"),c=require("./button-CdZDBhmr-3yMPCRDo.cjs"),t=require("./index-CGv7FLNy.cjs"),l=({actions:i,triggerProps:r,contentProps:x,title:o})=>s.jsxRuntimeExports.jsxs(n.Tt,{children:[s.jsxRuntimeExports.jsx(n.At,{asChild:!0,...r,children:s.jsxRuntimeExports.jsxs(c.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[s.jsxRuntimeExports.jsx(t.Wg,{})," ",s.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:o||"Actions"}),s.jsxRuntimeExports.jsx(t.f1,{})]})}),s.jsxRuntimeExports.jsx(n.it,{align:"end",...x,children:i.map((e,u)=>s.jsxRuntimeExports.jsx(n.ut,{onClick:()=>e.onClick(),children:e.label},u))})]});exports.Actions=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-h4oGeKUK.cjs"),e=require("./dropdown-menu-TWRSm6RK-DQ03CnVw.cjs"),l=require("./button-CdZDBhmr-3yMPCRDo.cjs"),n=require("./index-CGv7FLNy.cjs"),a=require("./Spin-DBoJvG-Y.cjs"),c=({options:r,loading:i=!1,triggerProps:x,contentProps:u,title:o})=>s.jsxRuntimeExports.jsxs(e.Tt,{children:[s.jsxRuntimeExports.jsx(e.At,{asChild:!0,...x,children:s.jsxRuntimeExports.jsxs(l.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[i?s.jsxRuntimeExports.jsx(a.Spin,{}):s.jsxRuntimeExports.jsx(n.ZC,{})," ",s.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:o||"Export"}),s.jsxRuntimeExports.jsx(n.f1,{})]})}),s.jsxRuntimeExports.jsx(e.it,{align:"end",...u,children:r.map((t,j)=>s.jsxRuntimeExports.jsx(e.ut,{onClick:()=>t.onClick(),children:t.label},j))})]});exports.ExportData=c;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { j as s } from "./jsx-runtime-DS1N_tNq.js";
|
|
2
|
+
import { T as o, A as m, i as x, u as d } from "./dropdown-menu-TWRSm6RK-D_FJpI4C.js";
|
|
3
|
+
import { u as c } from "./button-CdZDBhmr-BT_j3ig5.js";
|
|
4
|
+
import { Z as p, f as j } from "./index-BrQ82Wyu.js";
|
|
5
|
+
import { S as u } from "./Spin-D1geCtns.js";
|
|
6
|
+
const k = ({
|
|
7
|
+
options: a,
|
|
8
|
+
loading: i = !1,
|
|
9
|
+
triggerProps: e,
|
|
10
|
+
contentProps: n,
|
|
11
|
+
title: t
|
|
12
|
+
}) => /* @__PURE__ */ s.jsxs(o, { children: [
|
|
13
|
+
/* @__PURE__ */ s.jsx(m, { asChild: !0, ...e, children: /* @__PURE__ */ s.jsxs(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
variant: "secondary",
|
|
17
|
+
size: "sm",
|
|
18
|
+
className: "ml-auto rounded-lg px-3",
|
|
19
|
+
children: [
|
|
20
|
+
i ? /* @__PURE__ */ s.jsx(u, {}) : /* @__PURE__ */ s.jsx(p, {}),
|
|
21
|
+
" ",
|
|
22
|
+
/* @__PURE__ */ s.jsx("span", { className: "hidden lg:!inline", children: t || "Export" }),
|
|
23
|
+
/* @__PURE__ */ s.jsx(j, {})
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ s.jsx(x, { align: "end", ...n, children: a.map((r, l) => /* @__PURE__ */ s.jsx(d, { onClick: () => r.onClick(), children: r.label }, l)) })
|
|
28
|
+
] });
|
|
29
|
+
export {
|
|
30
|
+
k as E
|
|
31
|
+
};
|
|
@@ -1,120 +1,127 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-DS1N_tNq.js";
|
|
2
|
-
import { y as
|
|
3
|
-
import { u as
|
|
4
|
-
import { m as
|
|
5
|
-
import { u as
|
|
6
|
-
import { c as
|
|
7
|
-
import { memo as
|
|
8
|
-
import { l as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { M as
|
|
11
|
-
import { M as
|
|
12
|
-
import { u as
|
|
2
|
+
import { y as A, b as I } from "./input-mask-DBLFIvhN-BBxoZxnd.js";
|
|
3
|
+
import { u as c } from "./button-CdZDBhmr-BT_j3ig5.js";
|
|
4
|
+
import { m as L } from "./utils-B6fNqzRf-B1_jG1K7.js";
|
|
5
|
+
import { u as O } from "./useTranslation-dH-uwymc.js";
|
|
6
|
+
import { c as l } from "./createLucideIcon-B950nf2d.js";
|
|
7
|
+
import { memo as R, useState as b, useEffect as k, useCallback as v } from "react";
|
|
8
|
+
import { l as C } from "./lodash-CYNxjS-I.js";
|
|
9
|
+
import { _ as P, w as T, u as V } from "./popover-OZcfKDD9-C2PVWPLS.js";
|
|
10
|
+
import { M as W } from "./MyInput-B-QCpehg.js";
|
|
11
|
+
import { M as B } from "./MySelect-C5uWRVJh.js";
|
|
12
|
+
import { u as G } from "./useFilter-DJunNBm2.js";
|
|
13
13
|
/**
|
|
14
14
|
* @license lucide-react v0.511.0 - ISC
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the ISC license.
|
|
17
17
|
* See the LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const H = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], J = l("chevron-down", H);
|
|
20
20
|
/**
|
|
21
21
|
* @license lucide-react v0.511.0 - ISC
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the ISC license.
|
|
24
24
|
* See the LICENSE file in the root directory of this source tree.
|
|
25
25
|
*/
|
|
26
|
-
const
|
|
26
|
+
const K = [
|
|
27
27
|
["path", { d: "M10 18h4", key: "1ulq68" }],
|
|
28
28
|
["path", { d: "M11 6H3", key: "1u26ik" }],
|
|
29
29
|
["path", { d: "M15 6h6", key: "1jlkvy" }],
|
|
30
30
|
["path", { d: "M18 9V3", key: "xwwp7m" }],
|
|
31
31
|
["path", { d: "M7 12h8", key: "7a1bxv" }]
|
|
32
|
-
],
|
|
32
|
+
], Q = l("list-filter-plus", K);
|
|
33
33
|
/**
|
|
34
34
|
* @license lucide-react v0.511.0 - ISC
|
|
35
35
|
*
|
|
36
36
|
* This source code is licensed under the ISC license.
|
|
37
37
|
* See the LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/
|
|
39
|
-
const
|
|
39
|
+
const U = [
|
|
40
40
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
41
41
|
["path", { d: "M7 12h10", key: "b7w52i" }],
|
|
42
42
|
["path", { d: "M10 18h4", key: "1ulq68" }]
|
|
43
|
-
],
|
|
43
|
+
], X = l("list-filter", U);
|
|
44
44
|
/**
|
|
45
45
|
* @license lucide-react v0.511.0 - ISC
|
|
46
46
|
*
|
|
47
47
|
* This source code is licensed under the ISC license.
|
|
48
48
|
* See the LICENSE file in the root directory of this source tree.
|
|
49
49
|
*/
|
|
50
|
-
const
|
|
50
|
+
const Y = [
|
|
51
51
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
52
52
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
53
|
-
],
|
|
54
|
-
name:
|
|
53
|
+
], Z = l("search", Y), pe = ({
|
|
54
|
+
name: i = "search",
|
|
55
55
|
defaultValue: t,
|
|
56
56
|
onSearchChange: o,
|
|
57
57
|
placeholder: a,
|
|
58
58
|
className: r,
|
|
59
59
|
...x
|
|
60
60
|
}) => {
|
|
61
|
-
const { t:
|
|
62
|
-
const p = new FormData(
|
|
63
|
-
o(p.get(
|
|
61
|
+
const { t: m } = O(), d = (n) => {
|
|
62
|
+
const p = new FormData(n.currentTarget);
|
|
63
|
+
o(p.get(i) || void 0), n.preventDefault(), n.stopPropagation();
|
|
64
64
|
};
|
|
65
65
|
return /* @__PURE__ */ e.jsxs(
|
|
66
66
|
"form",
|
|
67
67
|
{
|
|
68
|
-
className:
|
|
69
|
-
onSubmit:
|
|
68
|
+
className: L("relative w-full max-w-64 min-w-40", r),
|
|
69
|
+
onSubmit: d,
|
|
70
70
|
children: [
|
|
71
71
|
/* @__PURE__ */ e.jsx(
|
|
72
|
-
|
|
72
|
+
A,
|
|
73
73
|
{
|
|
74
74
|
...x,
|
|
75
75
|
className: "h-8 rounded-lg",
|
|
76
|
-
name:
|
|
77
|
-
placeholder: a ||
|
|
76
|
+
name: i,
|
|
77
|
+
placeholder: a || m("Search..."),
|
|
78
78
|
defaultValue: t ? `${t}` : ""
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
81
|
/* @__PURE__ */ e.jsx(
|
|
82
|
-
|
|
82
|
+
c,
|
|
83
83
|
{
|
|
84
84
|
type: "submit",
|
|
85
85
|
variant: "ghost",
|
|
86
86
|
className: "text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",
|
|
87
87
|
size: "sm",
|
|
88
|
-
children: /* @__PURE__ */ e.jsx(
|
|
88
|
+
children: /* @__PURE__ */ e.jsx(Z, {})
|
|
89
89
|
}
|
|
90
90
|
)
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
|
-
},
|
|
94
|
+
}, he = R(function({
|
|
95
95
|
filters: t,
|
|
96
96
|
params: o,
|
|
97
97
|
onFilter: a,
|
|
98
98
|
onChange: r,
|
|
99
99
|
onCancel: x,
|
|
100
|
-
|
|
100
|
+
triggerProps: m,
|
|
101
|
+
contentProps: d,
|
|
102
|
+
title: n,
|
|
103
|
+
resetText: p,
|
|
104
|
+
applyText: N,
|
|
105
|
+
...M
|
|
101
106
|
}) {
|
|
102
|
-
const
|
|
107
|
+
const [w, g] = b(!1), [S, h] = b(!1), { form: j } = G({ params: o }), { watch: _, getValues: z, handleSubmit: $, control: y, reset: f } = j;
|
|
103
108
|
k(() => {
|
|
104
109
|
let s = !1;
|
|
105
|
-
t.map((
|
|
106
|
-
const u =
|
|
107
|
-
(Array.isArray(u) ? u.length > 0 : u) && (s = !0),
|
|
110
|
+
t.map((q) => {
|
|
111
|
+
const u = C.get(o, `${q.name}`);
|
|
112
|
+
(Array.isArray(u) ? u.length > 0 : u) && (s = !0), g(s);
|
|
108
113
|
});
|
|
109
|
-
}, [t, o])
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
}, [t, o]);
|
|
115
|
+
const D = _();
|
|
116
|
+
k(() => {
|
|
117
|
+
r == null || r(z());
|
|
118
|
+
}, [D]);
|
|
119
|
+
const E = v(
|
|
113
120
|
(s = {}) => {
|
|
114
121
|
a == null || a(s), h(!1);
|
|
115
122
|
},
|
|
116
123
|
[a]
|
|
117
|
-
),
|
|
124
|
+
), F = v(() => {
|
|
118
125
|
f(), a && o && a({
|
|
119
126
|
...o,
|
|
120
127
|
...Object.fromEntries(
|
|
@@ -122,27 +129,27 @@ const J = [
|
|
|
122
129
|
)
|
|
123
130
|
}), h(!1);
|
|
124
131
|
}, [a, f, o, t]);
|
|
125
|
-
return /* @__PURE__ */ e.jsxs(
|
|
126
|
-
/* @__PURE__ */ e.jsx(
|
|
127
|
-
|
|
132
|
+
return /* @__PURE__ */ e.jsxs(P, { open: S, onOpenChange: h, children: [
|
|
133
|
+
/* @__PURE__ */ e.jsx(T, { ...m, children: /* @__PURE__ */ e.jsx(
|
|
134
|
+
c,
|
|
128
135
|
{
|
|
129
136
|
asChild: !0,
|
|
130
137
|
size: "sm",
|
|
131
138
|
variant: "secondary",
|
|
132
139
|
className: "ml-auto px-3",
|
|
133
|
-
...
|
|
140
|
+
...M,
|
|
134
141
|
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
135
|
-
|
|
142
|
+
w ? /* @__PURE__ */ e.jsx(Q, { className: "size-5" }) : /* @__PURE__ */ e.jsx(X, { className: "size-5" }),
|
|
136
143
|
" ",
|
|
137
|
-
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: n
|
|
138
|
-
/* @__PURE__ */ e.jsx(
|
|
144
|
+
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: n || "Filter" }),
|
|
145
|
+
/* @__PURE__ */ e.jsx(J, {})
|
|
139
146
|
] })
|
|
140
147
|
}
|
|
141
148
|
) }),
|
|
142
|
-
/* @__PURE__ */ e.jsx(
|
|
149
|
+
/* @__PURE__ */ e.jsx(V, { side: "bottom", align: "end", ...d, children: /* @__PURE__ */ e.jsx(I, { ...j, children: /* @__PURE__ */ e.jsxs("form", { onSubmit: $(E), className: "space-y-2", children: [
|
|
143
150
|
/* @__PURE__ */ e.jsx("div", { className: "h-full shrink p-1", children: t.map(
|
|
144
151
|
(s) => s.options ? /* @__PURE__ */ e.jsx(
|
|
145
|
-
|
|
152
|
+
B,
|
|
146
153
|
{
|
|
147
154
|
control: y,
|
|
148
155
|
name: s.name,
|
|
@@ -153,7 +160,7 @@ const J = [
|
|
|
153
160
|
},
|
|
154
161
|
s.name
|
|
155
162
|
) : /* @__PURE__ */ e.jsx(
|
|
156
|
-
|
|
163
|
+
W,
|
|
157
164
|
{
|
|
158
165
|
control: y,
|
|
159
166
|
placeholder: s.placeholder,
|
|
@@ -165,21 +172,21 @@ const J = [
|
|
|
165
172
|
) }),
|
|
166
173
|
/* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 justify-end gap-2", children: [
|
|
167
174
|
/* @__PURE__ */ e.jsx(
|
|
168
|
-
|
|
175
|
+
c,
|
|
169
176
|
{
|
|
170
177
|
variant: "destructive",
|
|
171
178
|
type: "reset",
|
|
172
179
|
size: "sm",
|
|
173
|
-
onClick:
|
|
174
|
-
children:
|
|
180
|
+
onClick: F,
|
|
181
|
+
children: p || "Reset"
|
|
175
182
|
}
|
|
176
183
|
),
|
|
177
|
-
/* @__PURE__ */ e.jsx(
|
|
184
|
+
/* @__PURE__ */ e.jsx(c, { type: "submit", size: "sm", children: N || "Apply" })
|
|
178
185
|
] })
|
|
179
186
|
] }) }) })
|
|
180
187
|
] });
|
|
181
188
|
});
|
|
182
189
|
export {
|
|
183
|
-
|
|
184
|
-
|
|
190
|
+
he as F,
|
|
191
|
+
pe as S
|
|
185
192
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-h4oGeKUK.cjs"),b=require("./input-mask-DBLFIvhN-C_0RAR2l.cjs"),i=require("./button-CdZDBhmr-3yMPCRDo.cjs"),z=require("./utils-B6fNqzRf-BNysSCt9.cjs"),F=require("./useTranslation-CZf20ucv.cjs"),u=require("./createLucideIcon-BnAj0RnC.cjs"),o=require("react"),$=require("./lodash-C5w_OPmE.cjs"),j=require("./popover-OZcfKDD9-KUWOsIOs.cjs"),B=require("./MyInput-9MnlVZ4h.cjs"),C=require("./MySelect-DNK997Bi.cjs"),O=require("./useFilter-Cwz8oftI.cjs");/**
|
|
2
|
+
* @license lucide-react v0.511.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],T=u.createLucideIcon("chevron-down",A);/**
|
|
7
|
+
* @license lucide-react v0.511.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const W=[["path",{d:"M10 18h4",key:"1ulq68"}],["path",{d:"M11 6H3",key:"1u26ik"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 9V3",key:"xwwp7m"}],["path",{d:"M7 12h8",key:"7a1bxv"}]],P=u.createLucideIcon("list-filter-plus",W);/**
|
|
12
|
+
* @license lucide-react v0.511.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const V=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Z=u.createLucideIcon("list-filter",V);/**
|
|
17
|
+
* @license lucide-react v0.511.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const G=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],H=u.createLucideIcon("search",G),K=({name:l="search",defaultValue:n,onSearchChange:r,placeholder:t,className:c,...y})=>{const{t:x}=F.useTranslation(),p=a=>{const d=new FormData(a.currentTarget);r(d.get(l)||void 0),a.preventDefault(),a.stopPropagation()};return e.jsxRuntimeExports.jsxs("form",{className:z.mo("relative w-full max-w-64 min-w-40",c),onSubmit:p,children:[e.jsxRuntimeExports.jsx(b.yp,{...y,className:"h-8 rounded-lg",name:l,placeholder:t||x("Search..."),defaultValue:n?`${n}`:""}),e.jsxRuntimeExports.jsx(i.u,{type:"submit",variant:"ghost",className:"text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",size:"sm",children:e.jsxRuntimeExports.jsx(H,{})})]})},J=o.memo(function({filters:n,params:r,onFilter:t,onChange:c,onCancel:y,triggerProps:x,contentProps:p,title:a,resetText:d,applyText:v,...N}){const[q,f]=o.useState(!1),[M,m]=o.useState(!1),{form:E}=O.useFilter({params:r}),{watch:w,getValues:S,handleSubmit:g,control:R,reset:k}=E;o.useEffect(()=>{let s=!1;n.map(L=>{const h=$.lodashExports.get(r,`${L.name}`);(Array.isArray(h)?h.length>0:h)&&(s=!0),f(s)})},[n,r]);const I=w();o.useEffect(()=>{c==null||c(S())},[I]);const _=o.useCallback((s={})=>{t==null||t(s),m(!1)},[t]),D=o.useCallback(()=>{k(),t&&r&&t({...r,...Object.fromEntries(n.map(s=>[s.name,void 0]))}),m(!1)},[t,k,r,n]);return e.jsxRuntimeExports.jsxs(j._e,{open:M,onOpenChange:m,children:[e.jsxRuntimeExports.jsx(j.we,{...x,children:e.jsxRuntimeExports.jsx(i.u,{asChild:!0,size:"sm",variant:"secondary",className:"ml-auto px-3",...N,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[q?e.jsxRuntimeExports.jsx(P,{className:"size-5"}):e.jsxRuntimeExports.jsx(Z,{className:"size-5"})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:a||"Filter"}),e.jsxRuntimeExports.jsx(T,{})]})})}),e.jsxRuntimeExports.jsx(j.ue,{side:"bottom",align:"end",...p,children:e.jsxRuntimeExports.jsx(b.Gx,{...E,children:e.jsxRuntimeExports.jsxs("form",{onSubmit:g(_),className:"space-y-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-full shrink p-1",children:n.map(s=>s.options?e.jsxRuntimeExports.jsx(C.MySelect,{control:R,name:s.name,placeholder:s.placeholder,isMulti:s.isMulti,options:s.options,label:s.label},s.name):e.jsxRuntimeExports.jsx(B.MyInput,{control:R,placeholder:s.placeholder,name:s.name,label:s.label},s.name))}),e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[e.jsxRuntimeExports.jsx(i.u,{variant:"destructive",type:"reset",size:"sm",onClick:D,children:d||"Reset"}),e.jsxRuntimeExports.jsx(i.u,{type:"submit",size:"sm",children:v||"Apply"})]})]})})})]})});exports.FilterWrapper=J;exports.Search=K;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../Actions-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../Actions-Dh8TPahn.cjs");exports.Actions=t.Actions;
|