auxalia-ui-kit 1.6.9 → 1.7.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/README.md +26 -349
- package/dist/index.cjs +52 -40
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +52 -40
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,47 +1,25 @@
|
|
|
1
1
|
# Auxalia UI — `auxalia-ui-kit`
|
|
2
2
|
|
|
3
|
-
A modern, accessible React component library built with **TypeScript**, **Radix UI**, and **Tailwind CSS v4**.
|
|
3
|
+
A modern, accessible React component library built with **TypeScript**, **Radix UI**, and **Tailwind CSS v4**.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/auxalia-ui-kit)
|
|
6
6
|
[](https://opensource.org/licenses/ISC)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Overview
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- [Requirements](#requirements)
|
|
14
|
-
- [Installation](#installation)
|
|
15
|
-
- [Setup](#setup)
|
|
16
|
-
- [Components](#components)
|
|
17
|
-
- [Tailwind Preset](#tailwind-preset)
|
|
18
|
-
- [Design Tokens](#design-tokens)
|
|
19
|
-
- [Development](#development)
|
|
20
|
-
- [License](#license)
|
|
12
|
+
`auxalia-ui-kit` is a design system library for React apps. It ships a Tailwind v4 preset, component primitives, and runtime design tokens for light/dark theming.
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Features
|
|
25
|
-
|
|
26
|
-
- **Customizable** — CVA-powered variants for predictable, type-safe styling
|
|
27
|
-
- **Accessible** — Built on Radix UI primitives, WCAG compliant
|
|
28
|
-
- **Tree-Shakeable** — ESM + CJS dual output for optimal bundle size
|
|
29
|
-
- **Type-Safe** — Full TypeScript with strict types
|
|
30
|
-
- **Dark Mode** — All components support light/dark themes via CSS class
|
|
31
|
-
- **Tailwind v4** — Ships a Tailwind preset with Auxalia brand tokens
|
|
32
|
-
- **Storybook** — Interactive component explorer included
|
|
33
|
-
|
|
34
|
-
---
|
|
14
|
+
## Docs
|
|
35
15
|
|
|
36
|
-
|
|
16
|
+
This repository stores the source documentation in `docs/`:
|
|
37
17
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| react-dom | ^19.2.0 |
|
|
42
|
-
| tailwindcss | ^4.0.0 |
|
|
18
|
+
- `docs/CODE_RULES.md`
|
|
19
|
+
- `docs/MAKING_CHANGES.md`
|
|
20
|
+
- `docs/TABLE_SETUP.md`
|
|
43
21
|
|
|
44
|
-
|
|
22
|
+
For component usage and design token guidance, consult the Storybook and source files.
|
|
45
23
|
|
|
46
24
|
## Installation
|
|
47
25
|
|
|
@@ -49,314 +27,34 @@ A modern, accessible React component library built with **TypeScript**, **Radix
|
|
|
49
27
|
npm install auxalia-ui-kit
|
|
50
28
|
```
|
|
51
29
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Setup
|
|
30
|
+
## Quick Start
|
|
55
31
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
In your app's entry CSS file:
|
|
32
|
+
Import the library styles and use components in your React app:
|
|
59
33
|
|
|
60
34
|
```css
|
|
35
|
+
/* app.css */
|
|
61
36
|
@import 'auxalia-ui-kit/styles.css';
|
|
62
37
|
```
|
|
63
38
|
|
|
64
|
-
Or import the design tokens separately:
|
|
65
|
-
|
|
66
|
-
```css
|
|
67
|
-
@import 'auxalia-ui-kit/tokens.css';
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 2. Configure Tailwind v4
|
|
71
|
-
|
|
72
|
-
In your CSS config file (e.g. `app.css`):
|
|
73
|
-
|
|
74
|
-
```css
|
|
75
|
-
@import 'tailwindcss';
|
|
76
|
-
@import 'auxalia-ui-kit/tokens.css';
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Or use the Tailwind preset in your `tailwind.config.ts`:
|
|
80
|
-
|
|
81
|
-
```ts
|
|
82
|
-
import auxaliaPreset from 'auxalia-ui-kit/tailwind.preset';
|
|
83
|
-
|
|
84
|
-
export default {
|
|
85
|
-
presets: [auxaliaPreset],
|
|
86
|
-
};
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 3. Use components
|
|
90
|
-
|
|
91
39
|
```tsx
|
|
92
40
|
import { Button } from 'auxalia-ui-kit';
|
|
93
41
|
|
|
94
42
|
export default function App() {
|
|
95
|
-
return <Button variant="default"
|
|
43
|
+
return <Button variant="default">Click me</Button>;
|
|
96
44
|
}
|
|
97
45
|
```
|
|
98
46
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
## Components
|
|
102
|
-
|
|
103
|
-
### Button
|
|
104
|
-
|
|
105
|
-
```tsx
|
|
106
|
-
import { Button } from 'auxalia-ui-kit';
|
|
107
|
-
|
|
108
|
-
<Button variant="default" color="primary" size="default">Save</Button>
|
|
109
|
-
<Button variant="outline" color="secondary">Cancel</Button>
|
|
110
|
-
<Button variant="ghost" color="destructive" size="sm">Delete</Button>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
| Prop | Type | Default |
|
|
114
|
-
|-----------|--------------------------------------------------------|-------------|
|
|
115
|
-
| `variant` | `'default' \| 'outline' \| 'ghost' \| 'link'` | `'default'` |
|
|
116
|
-
| `color` | `'default' \| 'primary' \| 'secondary' \| 'accent' \| 'destructive'` | `'primary'` |
|
|
117
|
-
| `size` | `'sm' \| 'default' \| 'lg' \| 'icon'` | `'default'` |
|
|
118
|
-
| `asChild` | `boolean` | `false` |
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
### Card
|
|
123
|
-
|
|
124
|
-
```tsx
|
|
125
|
-
import { Card } from 'auxalia-ui-kit';
|
|
126
|
-
|
|
127
|
-
<Card variant="default">Content</Card>
|
|
128
|
-
<Card variant="elevated">Elevated</Card>
|
|
129
|
-
<Card variant="outlined">Outlined</Card>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
| Prop | Type | Default |
|
|
133
|
-
|-----------|----------------------------------------------------------------------------|-------------|
|
|
134
|
-
| `variant` | `'default' \| 'outlined' \| 'elevated' \| 'success' \| 'accent' \| 'secondary'` | `'default'` |
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
### Input
|
|
139
|
-
|
|
140
|
-
```tsx
|
|
141
|
-
import { Input } from 'auxalia-ui-kit';
|
|
142
|
-
|
|
143
|
-
<Input placeholder="Enter text..." />
|
|
144
|
-
<Input size="lg" variant="error" />
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
| Prop | Type | Default |
|
|
148
|
-
|-----------|----------------------------|-------------|
|
|
149
|
-
| `variant` | `'default' \| 'error'` | `'default'` |
|
|
150
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
### Select
|
|
155
|
-
|
|
156
|
-
```tsx
|
|
157
|
-
import {
|
|
158
|
-
Select, SelectTrigger, SelectValue,
|
|
159
|
-
SelectContent, SelectItem
|
|
160
|
-
} from 'auxalia-ui-kit';
|
|
161
|
-
|
|
162
|
-
<Select>
|
|
163
|
-
<SelectTrigger variant="primary" size="md">
|
|
164
|
-
<SelectValue placeholder="Pick one" />
|
|
165
|
-
</SelectTrigger>
|
|
166
|
-
<SelectContent>
|
|
167
|
-
<SelectItem value="a">Option A</SelectItem>
|
|
168
|
-
<SelectItem value="b">Option B</SelectItem>
|
|
169
|
-
</SelectContent>
|
|
170
|
-
</Select>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**SelectTrigger variants:** `'default' | 'primary' | 'secondary' | 'accent' | 'destructive' | 'error'`
|
|
174
|
-
|
|
175
|
-
**SelectTrigger sizes:** `'sm' | 'md' | 'lg'`
|
|
176
|
-
|
|
177
|
-
**SelectItem variants:** `'default' | 'primary' | 'secondary' | 'accent' | 'destructive'`
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
### DropdownMenu
|
|
182
|
-
|
|
183
|
-
```tsx
|
|
184
|
-
import {
|
|
185
|
-
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent,
|
|
186
|
-
DropdownMenuItem, DropdownMenuSeparator, DropdownMenuLabel
|
|
187
|
-
} from 'auxalia-ui-kit';
|
|
188
|
-
|
|
189
|
-
<DropdownMenu>
|
|
190
|
-
<DropdownMenuTrigger>Open</DropdownMenuTrigger>
|
|
191
|
-
<DropdownMenuContent>
|
|
192
|
-
<DropdownMenuLabel>Actions</DropdownMenuLabel>
|
|
193
|
-
<DropdownMenuSeparator />
|
|
194
|
-
<DropdownMenuItem variant="default">Edit</DropdownMenuItem>
|
|
195
|
-
<DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
|
|
196
|
-
</DropdownMenuContent>
|
|
197
|
-
</DropdownMenu>
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**DropdownMenuItem variants:** `'default' | 'primary' | 'secondary' | 'accent' | 'destructive'`
|
|
201
|
-
|
|
202
|
-
Also exports: `DropdownMenuCheckboxItem`, `DropdownMenuRadioItem`, `DropdownMenuRadioGroup`,
|
|
203
|
-
`DropdownMenuGroup`, `DropdownMenuSub`, `DropdownMenuSubTrigger`, `DropdownMenuSubContent`,
|
|
204
|
-
`DropdownMenuShortcut`, `DropdownMenuPortal`
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
### Tabs
|
|
209
|
-
|
|
210
|
-
```tsx
|
|
211
|
-
import { Tabs, TabsList, TabsTrigger, TabsContent } from 'auxalia-ui-kit';
|
|
212
|
-
|
|
213
|
-
const [tab, setTab] = useState('overview');
|
|
214
|
-
|
|
215
|
-
<Tabs value={tab} onValueChange={setTab}>
|
|
216
|
-
<TabsList>
|
|
217
|
-
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
218
|
-
<TabsTrigger value="settings">Settings</TabsTrigger>
|
|
219
|
-
</TabsList>
|
|
220
|
-
<TabsContent value="overview">Overview content</TabsContent>
|
|
221
|
-
<TabsContent value="settings">Settings content</TabsContent>
|
|
222
|
-
</Tabs>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
### Text
|
|
228
|
-
|
|
229
|
-
```tsx
|
|
230
|
-
import { Text } from 'auxalia-ui-kit';
|
|
231
|
-
|
|
232
|
-
<Text size="xl" align="center">Hello World</Text>
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
| Prop | Type | Default |
|
|
236
|
-
|---------|---------------------------------------------|----------|
|
|
237
|
-
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl' \| '3xl'` | `'md'` |
|
|
238
|
-
| `align` | `'left' \| 'center' \| 'right'` | `'left'` |
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
### Field (Form Wrapper)
|
|
243
|
-
|
|
244
|
-
```tsx
|
|
245
|
-
import {
|
|
246
|
-
Field, FieldLabel, FieldDescription, FieldError
|
|
247
|
-
} from 'auxalia-ui-kit';
|
|
248
|
-
|
|
249
|
-
<Field orientation="vertical">
|
|
250
|
-
<FieldLabel>Email</FieldLabel>
|
|
251
|
-
<Input type="email" />
|
|
252
|
-
<FieldDescription>We'll never share your email.</FieldDescription>
|
|
253
|
-
<FieldError errors={['Email is required']} />
|
|
254
|
-
</Field>
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**Orientation:** `'vertical'` (default) | `'horizontal'` | `'responsive'`
|
|
258
|
-
|
|
259
|
-
Also exports: `FieldContent`, `FieldGroup`, `FieldSet`, `FieldLegend`, `FieldSeparator`, `FieldTitle`
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
### Tooltip
|
|
264
|
-
|
|
265
|
-
```tsx
|
|
266
|
-
import { Tooltip, TooltipTrigger, TooltipContent } from 'auxalia-ui-kit';
|
|
267
|
-
|
|
268
|
-
<Tooltip>
|
|
269
|
-
<TooltipTrigger>Hover me</TooltipTrigger>
|
|
270
|
-
<TooltipContent>Helpful hint</TooltipContent>
|
|
271
|
-
</Tooltip>
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
Also exports: `TooltipProvider`
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
### Popover
|
|
279
|
-
|
|
280
|
-
```tsx
|
|
281
|
-
import { Popover, PopoverTrigger, PopoverContent } from 'auxalia-ui-kit';
|
|
282
|
-
|
|
283
|
-
<Popover>
|
|
284
|
-
<PopoverTrigger>Open</PopoverTrigger>
|
|
285
|
-
<PopoverContent>Popover content here</PopoverContent>
|
|
286
|
-
</Popover>
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Also exports: `PopoverAnchor`
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
|
-
### Pagination
|
|
294
|
-
|
|
295
|
-
```tsx
|
|
296
|
-
import {
|
|
297
|
-
Pagination, PaginationContent, PaginationItem,
|
|
298
|
-
PaginationLink, PaginationPrevious, PaginationNext, PaginationEllipsis
|
|
299
|
-
} from 'auxalia-ui-kit';
|
|
300
|
-
|
|
301
|
-
<Pagination>
|
|
302
|
-
<PaginationContent>
|
|
303
|
-
<PaginationItem><PaginationPrevious href="#" /></PaginationItem>
|
|
304
|
-
<PaginationItem><PaginationLink href="#" isActive>1</PaginationLink></PaginationItem>
|
|
305
|
-
<PaginationItem><PaginationLink href="#">2</PaginationLink></PaginationItem>
|
|
306
|
-
<PaginationItem><PaginationEllipsis /></PaginationItem>
|
|
307
|
-
<PaginationItem><PaginationNext href="#" /></PaginationItem>
|
|
308
|
-
</PaginationContent>
|
|
309
|
-
</Pagination>
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
---
|
|
313
|
-
|
|
314
|
-
### Collapsible
|
|
315
|
-
|
|
316
|
-
```tsx
|
|
317
|
-
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent } from 'auxalia-ui-kit';
|
|
318
|
-
|
|
319
|
-
<CollapsibleRoot>
|
|
320
|
-
<CollapsibleTrigger>Toggle</CollapsibleTrigger>
|
|
321
|
-
<CollapsibleContent>Hidden content</CollapsibleContent>
|
|
322
|
-
</CollapsibleRoot>
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
---
|
|
326
|
-
|
|
327
|
-
### Label
|
|
328
|
-
|
|
329
|
-
```tsx
|
|
330
|
-
import { Label } from 'auxalia-ui-kit';
|
|
47
|
+
## Development
|
|
331
48
|
|
|
332
|
-
|
|
49
|
+
```bash
|
|
50
|
+
npm install
|
|
51
|
+
npm run storybook
|
|
52
|
+
npm run build-storybook
|
|
333
53
|
```
|
|
334
54
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
### TableView
|
|
338
|
-
|
|
339
|
-
A full-featured controlled data table with sorting, filtering, pagination, and search.
|
|
340
|
-
|
|
341
|
-
```tsx
|
|
342
|
-
import { TableView } from 'auxalia-ui-kit';
|
|
343
|
-
import type { TableField, TableConfig } from 'auxalia-ui-kit';
|
|
344
|
-
|
|
345
|
-
const fields: TableField[] = [
|
|
346
|
-
{ key: 'name', label: 'Name', sortable: true },
|
|
347
|
-
{ key: 'email', label: 'Email' },
|
|
348
|
-
];
|
|
349
|
-
|
|
350
|
-
<TableView
|
|
351
|
-
data={rows}
|
|
352
|
-
fields={fields}
|
|
353
|
-
config={config}
|
|
354
|
-
queryParams={queryParams}
|
|
355
|
-
onQueryChange={setQueryParams}
|
|
356
|
-
/>
|
|
357
|
-
```
|
|
55
|
+
## License
|
|
358
56
|
|
|
359
|
-
|
|
57
|
+
ISC — [Auxalia](https://github.com/Artur-Badalyan/auxalia-ui-kit)
|
|
360
58
|
|
|
361
59
|
## Tailwind Preset
|
|
362
60
|
|
|
@@ -372,12 +70,12 @@ export default {
|
|
|
372
70
|
|
|
373
71
|
**Brand colors available in Tailwind utilities:**
|
|
374
72
|
|
|
375
|
-
| Token | Value
|
|
376
|
-
|
|
377
|
-
| `primary` | #A7D500
|
|
378
|
-
| `secondary` | #3e6897
|
|
379
|
-
| `accent` | #0f868b
|
|
380
|
-
| `destructive` | #dc2626
|
|
73
|
+
| Token | Value | Usage |
|
|
74
|
+
| ------------------ | ------------ | ----------------------- |
|
|
75
|
+
| `primary` | #A7D500 | Auxalia Green |
|
|
76
|
+
| `secondary` | #3e6897 | Auxalia Blue |
|
|
77
|
+
| `accent` | #0f868b | Auxalia Petrol |
|
|
78
|
+
| `destructive` | #dc2626 | Errors / danger |
|
|
381
79
|
| `auxalia-green-*` | 50–900 scale | Extended green palette |
|
|
382
80
|
| `auxalia-blue-*` | 50–900 scale | Extended blue palette |
|
|
383
81
|
| `auxalia-petrol-*` | 50–900 scale | Extended petrol palette |
|
|
@@ -401,24 +99,3 @@ Tokens are exposed as CSS custom properties and can be used independently:
|
|
|
401
99
|
background: rgb(var(--color-surface));
|
|
402
100
|
}
|
|
403
101
|
```
|
|
404
|
-
|
|
405
|
-
---
|
|
406
|
-
|
|
407
|
-
## Development
|
|
408
|
-
|
|
409
|
-
```bash
|
|
410
|
-
# Install dependencies
|
|
411
|
-
npm install
|
|
412
|
-
|
|
413
|
-
# Run Storybook (port 6006)
|
|
414
|
-
npm run storybook
|
|
415
|
-
|
|
416
|
-
# Build static Storybook
|
|
417
|
-
npm run build-storybook
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
---
|
|
421
|
-
|
|
422
|
-
## License
|
|
423
|
-
|
|
424
|
-
ISC — [Auxalia](https://github.com/Artur-Badalyan/auxalia-ui-kit)
|
package/dist/index.cjs
CHANGED
|
@@ -6688,25 +6688,52 @@ function Text({ size: size4 = "md", className, ...props }) {
|
|
|
6688
6688
|
}
|
|
6689
6689
|
|
|
6690
6690
|
// src/components/ControlledTable/index.tsx
|
|
6691
|
-
var
|
|
6691
|
+
var import_react11 = require("react");
|
|
6692
6692
|
var import_radix_ui8 = require("radix-ui");
|
|
6693
6693
|
var import_lucide_react8 = require("lucide-react");
|
|
6694
6694
|
|
|
6695
6695
|
// src/components/ControlledTable/toolbar/index.tsx
|
|
6696
|
-
var
|
|
6696
|
+
var import_react10 = require("react");
|
|
6697
6697
|
var import_lucide_react7 = require("lucide-react");
|
|
6698
6698
|
|
|
6699
6699
|
// src/components/ControlledTable/SimpleSearch.tsx
|
|
6700
|
+
var import_react8 = require("react");
|
|
6700
6701
|
var import_lucide_react6 = require("lucide-react");
|
|
6702
|
+
|
|
6703
|
+
// src/components/ControlledTable/useDebounce.ts
|
|
6704
|
+
var import_react7 = require("react");
|
|
6705
|
+
function useDebounce(value, delay) {
|
|
6706
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react7.useState)(value);
|
|
6707
|
+
(0, import_react7.useEffect)(() => {
|
|
6708
|
+
const timer = setTimeout(() => {
|
|
6709
|
+
setDebouncedValue(value);
|
|
6710
|
+
}, delay);
|
|
6711
|
+
return () => clearTimeout(timer);
|
|
6712
|
+
}, [value, delay]);
|
|
6713
|
+
return debouncedValue;
|
|
6714
|
+
}
|
|
6715
|
+
var useDebounce_default = useDebounce;
|
|
6716
|
+
|
|
6717
|
+
// src/components/ControlledTable/SimpleSearch.tsx
|
|
6701
6718
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6702
6719
|
var SimpleSearch = ({
|
|
6703
6720
|
searchValue,
|
|
6704
6721
|
onSearchCallback,
|
|
6705
6722
|
placeholder = "Search..."
|
|
6706
6723
|
}) => {
|
|
6707
|
-
const
|
|
6708
|
-
|
|
6709
|
-
|
|
6724
|
+
const [localValue, setLocalValue] = (0, import_react8.useState)(searchValue);
|
|
6725
|
+
const debouncedValue = useDebounce_default(localValue, 400);
|
|
6726
|
+
const isFirstRender = (0, import_react8.useRef)(true);
|
|
6727
|
+
(0, import_react8.useEffect)(() => {
|
|
6728
|
+
setLocalValue(searchValue);
|
|
6729
|
+
}, [searchValue]);
|
|
6730
|
+
(0, import_react8.useEffect)(() => {
|
|
6731
|
+
if (isFirstRender.current) {
|
|
6732
|
+
isFirstRender.current = false;
|
|
6733
|
+
return;
|
|
6734
|
+
}
|
|
6735
|
+
onSearchCallback?.(debouncedValue);
|
|
6736
|
+
}, [debouncedValue]);
|
|
6710
6737
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative", children: [
|
|
6711
6738
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6712
6739
|
import_lucide_react6.SearchIcon,
|
|
@@ -6718,8 +6745,8 @@ var SimpleSearch = ({
|
|
|
6718
6745
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6719
6746
|
Input,
|
|
6720
6747
|
{
|
|
6721
|
-
value:
|
|
6722
|
-
onChange:
|
|
6748
|
+
value: localValue,
|
|
6749
|
+
onChange: (e) => setLocalValue(e.target.value),
|
|
6723
6750
|
placeholder,
|
|
6724
6751
|
className: "pl-9"
|
|
6725
6752
|
}
|
|
@@ -6729,23 +6756,7 @@ var SimpleSearch = ({
|
|
|
6729
6756
|
var SimpleSearch_default = SimpleSearch;
|
|
6730
6757
|
|
|
6731
6758
|
// src/components/ControlledTable/tableFilter/filterItem/filterSelect/index.tsx
|
|
6732
|
-
var
|
|
6733
|
-
|
|
6734
|
-
// src/components/ControlledTable/useDebounce.ts
|
|
6735
|
-
var import_react7 = require("react");
|
|
6736
|
-
function useDebounce(value, delay) {
|
|
6737
|
-
const [debouncedValue, setDebouncedValue] = (0, import_react7.useState)(value);
|
|
6738
|
-
(0, import_react7.useEffect)(() => {
|
|
6739
|
-
const timer = setTimeout(() => {
|
|
6740
|
-
setDebouncedValue(value);
|
|
6741
|
-
}, delay);
|
|
6742
|
-
return () => clearTimeout(timer);
|
|
6743
|
-
}, [value, delay]);
|
|
6744
|
-
return debouncedValue;
|
|
6745
|
-
}
|
|
6746
|
-
var useDebounce_default = useDebounce;
|
|
6747
|
-
|
|
6748
|
-
// src/components/ControlledTable/tableFilter/filterItem/filterSelect/index.tsx
|
|
6759
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
6749
6760
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6750
6761
|
var CustomFilterSelect = ({
|
|
6751
6762
|
field,
|
|
@@ -6753,26 +6764,26 @@ var CustomFilterSelect = ({
|
|
|
6753
6764
|
searchValue,
|
|
6754
6765
|
className
|
|
6755
6766
|
}) => {
|
|
6756
|
-
const [searchTerm, setSearchTerm] =
|
|
6767
|
+
const [searchTerm, setSearchTerm] = import_react9.default.useState(searchValue);
|
|
6757
6768
|
const debouncedValue = useDebounce_default(
|
|
6758
6769
|
typeof searchTerm === "object" ? searchTerm : { [field?.id]: searchTerm },
|
|
6759
6770
|
1e3
|
|
6760
6771
|
);
|
|
6761
|
-
const [modifiedOptions, setModifiedOptions] = (0,
|
|
6762
|
-
(0,
|
|
6772
|
+
const [modifiedOptions, setModifiedOptions] = (0, import_react9.useState)([]);
|
|
6773
|
+
(0, import_react9.useEffect)(() => {
|
|
6763
6774
|
setSearchTerm({ [field.id]: searchValue });
|
|
6764
6775
|
}, [field, searchValue]);
|
|
6765
|
-
(0,
|
|
6776
|
+
(0, import_react9.useEffect)(() => {
|
|
6766
6777
|
if (onFilterCallback) {
|
|
6767
6778
|
onFilterCallback(debouncedValue);
|
|
6768
6779
|
}
|
|
6769
6780
|
}, [debouncedValue]);
|
|
6770
|
-
(0,
|
|
6781
|
+
(0, import_react9.useEffect)(() => {
|
|
6771
6782
|
if (typeof field.options === "function") {
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
setModifiedOptions(field.adapterCallback(
|
|
6775
|
-
});
|
|
6783
|
+
field.options({}).then((res) => {
|
|
6784
|
+
const raw = res?.data?.data ?? res?.data ?? res;
|
|
6785
|
+
setModifiedOptions(field.adapterCallback(raw));
|
|
6786
|
+
}).catch(() => setModifiedOptions([]));
|
|
6776
6787
|
} else {
|
|
6777
6788
|
setModifiedOptions(field.options);
|
|
6778
6789
|
}
|
|
@@ -6781,7 +6792,7 @@ var CustomFilterSelect = ({
|
|
|
6781
6792
|
const actualValue = value === "__none__" ? "" : value;
|
|
6782
6793
|
setSearchTerm({ [field.id]: actualValue });
|
|
6783
6794
|
};
|
|
6784
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `min-w-
|
|
6795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `min-w-50 ${className ?? ""}`, children: [
|
|
6785
6796
|
field.label && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "mb-1.5 text-sm text-neutral-600", children: field.label }),
|
|
6786
6797
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6787
6798
|
Select2,
|
|
@@ -6796,7 +6807,7 @@ var CustomFilterSelect = ({
|
|
|
6796
6807
|
SelectItem2,
|
|
6797
6808
|
{
|
|
6798
6809
|
value: String(opt.id ?? opt.value),
|
|
6799
|
-
children: opt.title
|
|
6810
|
+
children: opt.title ?? opt.label
|
|
6800
6811
|
},
|
|
6801
6812
|
String(opt.id ?? opt.value)
|
|
6802
6813
|
))
|
|
@@ -6880,7 +6891,7 @@ var CommonToolbar = ({
|
|
|
6880
6891
|
onSearchCallback,
|
|
6881
6892
|
onFilterCallback
|
|
6882
6893
|
}) => {
|
|
6883
|
-
const [isFilterOpen, setIsFilterOpen] = (0,
|
|
6894
|
+
const [isFilterOpen, setIsFilterOpen] = (0, import_react10.useState)(false);
|
|
6884
6895
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { children: [
|
|
6885
6896
|
title && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "px-4 pt-3 text-base font-semibold uppercase tracking-wide text-content", children: title }),
|
|
6886
6897
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-card-hover bg-card px-4 py-2", children: [
|
|
@@ -7082,10 +7093,11 @@ var ControlledTable = ({
|
|
|
7082
7093
|
getDataOnChange
|
|
7083
7094
|
}) => {
|
|
7084
7095
|
const { fields, filterFields, rowsPerPageOptions } = tableConfig;
|
|
7085
|
-
const { data: tableData, count: count3 } = tableSource;
|
|
7096
|
+
const { data: tableData, count: count3, total } = tableSource;
|
|
7097
|
+
const totalCount = count3 ?? total ?? 0;
|
|
7086
7098
|
const { limit = 10, offset: offset4 = 0 } = filteredParams ?? {};
|
|
7087
7099
|
const sortObj = filteredParams?.sort;
|
|
7088
|
-
(0,
|
|
7100
|
+
(0, import_react11.useEffect)(() => {
|
|
7089
7101
|
if (!filteredParams?.limit) {
|
|
7090
7102
|
const next = { ...filteredParams, limit: 10, offset: 0 };
|
|
7091
7103
|
setFilteredParams(next);
|
|
@@ -7342,13 +7354,13 @@ var ControlledTable = ({
|
|
|
7342
7354
|
}) })
|
|
7343
7355
|
] }) })
|
|
7344
7356
|
] }),
|
|
7345
|
-
withPagination &&
|
|
7357
|
+
withPagination && totalCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-t border-card-hover bg-card px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7346
7358
|
ControlledPagination_default,
|
|
7347
7359
|
{
|
|
7348
7360
|
currentPage,
|
|
7349
7361
|
rowsPerPage: Number(limit),
|
|
7350
7362
|
rowsPerPageOptions: rowsPerPageOptions ?? [10, 25, 50],
|
|
7351
|
-
totalCount
|
|
7363
|
+
totalCount,
|
|
7352
7364
|
onPageChange: handlePageChange,
|
|
7353
7365
|
onRowsPerPageChange: handleRowsPerPageChange
|
|
7354
7366
|
}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6567,7 +6567,7 @@ function Text({ size: size4 = "md", className, ...props }) {
|
|
|
6567
6567
|
}
|
|
6568
6568
|
|
|
6569
6569
|
// src/components/ControlledTable/index.tsx
|
|
6570
|
-
import { useEffect as
|
|
6570
|
+
import { useEffect as useEffect17 } from "react";
|
|
6571
6571
|
import { Checkbox as Checkbox2 } from "radix-ui";
|
|
6572
6572
|
import {
|
|
6573
6573
|
Check as Check4,
|
|
@@ -6584,7 +6584,7 @@ import {
|
|
|
6584
6584
|
} from "lucide-react";
|
|
6585
6585
|
|
|
6586
6586
|
// src/components/ControlledTable/toolbar/index.tsx
|
|
6587
|
-
import { useState as
|
|
6587
|
+
import { useState as useState16 } from "react";
|
|
6588
6588
|
import {
|
|
6589
6589
|
Trash2,
|
|
6590
6590
|
Edit,
|
|
@@ -6599,16 +6599,43 @@ import {
|
|
|
6599
6599
|
} from "lucide-react";
|
|
6600
6600
|
|
|
6601
6601
|
// src/components/ControlledTable/SimpleSearch.tsx
|
|
6602
|
+
import { useState as useState14, useEffect as useEffect15, useRef as useRef12 } from "react";
|
|
6602
6603
|
import { SearchIcon } from "lucide-react";
|
|
6604
|
+
|
|
6605
|
+
// src/components/ControlledTable/useDebounce.ts
|
|
6606
|
+
import { useState as useState13, useEffect as useEffect14 } from "react";
|
|
6607
|
+
function useDebounce(value, delay) {
|
|
6608
|
+
const [debouncedValue, setDebouncedValue] = useState13(value);
|
|
6609
|
+
useEffect14(() => {
|
|
6610
|
+
const timer = setTimeout(() => {
|
|
6611
|
+
setDebouncedValue(value);
|
|
6612
|
+
}, delay);
|
|
6613
|
+
return () => clearTimeout(timer);
|
|
6614
|
+
}, [value, delay]);
|
|
6615
|
+
return debouncedValue;
|
|
6616
|
+
}
|
|
6617
|
+
var useDebounce_default = useDebounce;
|
|
6618
|
+
|
|
6619
|
+
// src/components/ControlledTable/SimpleSearch.tsx
|
|
6603
6620
|
import { jsx as jsx34, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6604
6621
|
var SimpleSearch = ({
|
|
6605
6622
|
searchValue,
|
|
6606
6623
|
onSearchCallback,
|
|
6607
6624
|
placeholder = "Search..."
|
|
6608
6625
|
}) => {
|
|
6609
|
-
const
|
|
6610
|
-
|
|
6611
|
-
|
|
6626
|
+
const [localValue, setLocalValue] = useState14(searchValue);
|
|
6627
|
+
const debouncedValue = useDebounce_default(localValue, 400);
|
|
6628
|
+
const isFirstRender = useRef12(true);
|
|
6629
|
+
useEffect15(() => {
|
|
6630
|
+
setLocalValue(searchValue);
|
|
6631
|
+
}, [searchValue]);
|
|
6632
|
+
useEffect15(() => {
|
|
6633
|
+
if (isFirstRender.current) {
|
|
6634
|
+
isFirstRender.current = false;
|
|
6635
|
+
return;
|
|
6636
|
+
}
|
|
6637
|
+
onSearchCallback?.(debouncedValue);
|
|
6638
|
+
}, [debouncedValue]);
|
|
6612
6639
|
return /* @__PURE__ */ jsxs9("div", { className: "relative", children: [
|
|
6613
6640
|
/* @__PURE__ */ jsx34(
|
|
6614
6641
|
SearchIcon,
|
|
@@ -6620,8 +6647,8 @@ var SimpleSearch = ({
|
|
|
6620
6647
|
/* @__PURE__ */ jsx34(
|
|
6621
6648
|
Input,
|
|
6622
6649
|
{
|
|
6623
|
-
value:
|
|
6624
|
-
onChange:
|
|
6650
|
+
value: localValue,
|
|
6651
|
+
onChange: (e) => setLocalValue(e.target.value),
|
|
6625
6652
|
placeholder,
|
|
6626
6653
|
className: "pl-9"
|
|
6627
6654
|
}
|
|
@@ -6631,23 +6658,7 @@ var SimpleSearch = ({
|
|
|
6631
6658
|
var SimpleSearch_default = SimpleSearch;
|
|
6632
6659
|
|
|
6633
6660
|
// src/components/ControlledTable/tableFilter/filterItem/filterSelect/index.tsx
|
|
6634
|
-
import
|
|
6635
|
-
|
|
6636
|
-
// src/components/ControlledTable/useDebounce.ts
|
|
6637
|
-
import { useState as useState13, useEffect as useEffect14 } from "react";
|
|
6638
|
-
function useDebounce(value, delay) {
|
|
6639
|
-
const [debouncedValue, setDebouncedValue] = useState13(value);
|
|
6640
|
-
useEffect14(() => {
|
|
6641
|
-
const timer = setTimeout(() => {
|
|
6642
|
-
setDebouncedValue(value);
|
|
6643
|
-
}, delay);
|
|
6644
|
-
return () => clearTimeout(timer);
|
|
6645
|
-
}, [value, delay]);
|
|
6646
|
-
return debouncedValue;
|
|
6647
|
-
}
|
|
6648
|
-
var useDebounce_default = useDebounce;
|
|
6649
|
-
|
|
6650
|
-
// src/components/ControlledTable/tableFilter/filterItem/filterSelect/index.tsx
|
|
6661
|
+
import React42, { useEffect as useEffect16, useState as useState15 } from "react";
|
|
6651
6662
|
import { jsx as jsx35, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6652
6663
|
var CustomFilterSelect = ({
|
|
6653
6664
|
field,
|
|
@@ -6655,26 +6666,26 @@ var CustomFilterSelect = ({
|
|
|
6655
6666
|
searchValue,
|
|
6656
6667
|
className
|
|
6657
6668
|
}) => {
|
|
6658
|
-
const [searchTerm, setSearchTerm] =
|
|
6669
|
+
const [searchTerm, setSearchTerm] = React42.useState(searchValue);
|
|
6659
6670
|
const debouncedValue = useDebounce_default(
|
|
6660
6671
|
typeof searchTerm === "object" ? searchTerm : { [field?.id]: searchTerm },
|
|
6661
6672
|
1e3
|
|
6662
6673
|
);
|
|
6663
|
-
const [modifiedOptions, setModifiedOptions] =
|
|
6664
|
-
|
|
6674
|
+
const [modifiedOptions, setModifiedOptions] = useState15([]);
|
|
6675
|
+
useEffect16(() => {
|
|
6665
6676
|
setSearchTerm({ [field.id]: searchValue });
|
|
6666
6677
|
}, [field, searchValue]);
|
|
6667
|
-
|
|
6678
|
+
useEffect16(() => {
|
|
6668
6679
|
if (onFilterCallback) {
|
|
6669
6680
|
onFilterCallback(debouncedValue);
|
|
6670
6681
|
}
|
|
6671
6682
|
}, [debouncedValue]);
|
|
6672
|
-
|
|
6683
|
+
useEffect16(() => {
|
|
6673
6684
|
if (typeof field.options === "function") {
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
setModifiedOptions(field.adapterCallback(
|
|
6677
|
-
});
|
|
6685
|
+
field.options({}).then((res) => {
|
|
6686
|
+
const raw = res?.data?.data ?? res?.data ?? res;
|
|
6687
|
+
setModifiedOptions(field.adapterCallback(raw));
|
|
6688
|
+
}).catch(() => setModifiedOptions([]));
|
|
6678
6689
|
} else {
|
|
6679
6690
|
setModifiedOptions(field.options);
|
|
6680
6691
|
}
|
|
@@ -6683,7 +6694,7 @@ var CustomFilterSelect = ({
|
|
|
6683
6694
|
const actualValue = value === "__none__" ? "" : value;
|
|
6684
6695
|
setSearchTerm({ [field.id]: actualValue });
|
|
6685
6696
|
};
|
|
6686
|
-
return /* @__PURE__ */ jsxs10("div", { className: `min-w-
|
|
6697
|
+
return /* @__PURE__ */ jsxs10("div", { className: `min-w-50 ${className ?? ""}`, children: [
|
|
6687
6698
|
field.label && /* @__PURE__ */ jsx35("p", { className: "mb-1.5 text-sm text-neutral-600", children: field.label }),
|
|
6688
6699
|
/* @__PURE__ */ jsxs10(
|
|
6689
6700
|
Select2,
|
|
@@ -6698,7 +6709,7 @@ var CustomFilterSelect = ({
|
|
|
6698
6709
|
SelectItem2,
|
|
6699
6710
|
{
|
|
6700
6711
|
value: String(opt.id ?? opt.value),
|
|
6701
|
-
children: opt.title
|
|
6712
|
+
children: opt.title ?? opt.label
|
|
6702
6713
|
},
|
|
6703
6714
|
String(opt.id ?? opt.value)
|
|
6704
6715
|
))
|
|
@@ -6782,7 +6793,7 @@ var CommonToolbar = ({
|
|
|
6782
6793
|
onSearchCallback,
|
|
6783
6794
|
onFilterCallback
|
|
6784
6795
|
}) => {
|
|
6785
|
-
const [isFilterOpen, setIsFilterOpen] =
|
|
6796
|
+
const [isFilterOpen, setIsFilterOpen] = useState16(false);
|
|
6786
6797
|
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
6787
6798
|
title && /* @__PURE__ */ jsx38("p", { className: "px-4 pt-3 text-base font-semibold uppercase tracking-wide text-content", children: title }),
|
|
6788
6799
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-4 border-b border-card-hover bg-card px-4 py-2", children: [
|
|
@@ -6984,10 +6995,11 @@ var ControlledTable = ({
|
|
|
6984
6995
|
getDataOnChange
|
|
6985
6996
|
}) => {
|
|
6986
6997
|
const { fields, filterFields, rowsPerPageOptions } = tableConfig;
|
|
6987
|
-
const { data: tableData, count: count3 } = tableSource;
|
|
6998
|
+
const { data: tableData, count: count3, total } = tableSource;
|
|
6999
|
+
const totalCount = count3 ?? total ?? 0;
|
|
6988
7000
|
const { limit = 10, offset: offset4 = 0 } = filteredParams ?? {};
|
|
6989
7001
|
const sortObj = filteredParams?.sort;
|
|
6990
|
-
|
|
7002
|
+
useEffect17(() => {
|
|
6991
7003
|
if (!filteredParams?.limit) {
|
|
6992
7004
|
const next = { ...filteredParams, limit: 10, offset: 0 };
|
|
6993
7005
|
setFilteredParams(next);
|
|
@@ -7244,13 +7256,13 @@ var ControlledTable = ({
|
|
|
7244
7256
|
}) })
|
|
7245
7257
|
] }) })
|
|
7246
7258
|
] }),
|
|
7247
|
-
withPagination &&
|
|
7259
|
+
withPagination && totalCount > 0 && /* @__PURE__ */ jsx40("div", { className: "border-t border-card-hover bg-card px-4 py-2", children: /* @__PURE__ */ jsx40(
|
|
7248
7260
|
ControlledPagination_default,
|
|
7249
7261
|
{
|
|
7250
7262
|
currentPage,
|
|
7251
7263
|
rowsPerPage: Number(limit),
|
|
7252
7264
|
rowsPerPageOptions: rowsPerPageOptions ?? [10, 25, 50],
|
|
7253
|
-
totalCount
|
|
7265
|
+
totalCount,
|
|
7254
7266
|
onPageChange: handlePageChange,
|
|
7255
7267
|
onRowsPerPageChange: handleRowsPerPageChange
|
|
7256
7268
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auxalia-ui-kit",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "Auxalia UI Kit is a React component library built on top of Radix UI and Tailwind CSS, designed to provide a comprehensive set of accessible and customizable UI components for building modern web applications.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "auxalia-GmbH",
|