hazo_ui 2.2.1 → 2.2.3
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 +59 -0
- package/dist/index.cjs +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/styles.css +59 -0
- package/package.json +5 -2
- package/tailwind.preset.js +86 -0
package/README.md
CHANGED
|
@@ -8,6 +8,41 @@ A set of UI components for common interaction elements in a SaaS app.
|
|
|
8
8
|
npm install hazo_ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Quick Setup (Required)
|
|
12
|
+
|
|
13
|
+
hazo_ui uses Tailwind CSS and CSS variables for styling. Follow these two steps:
|
|
14
|
+
|
|
15
|
+
### Step 1: Import the CSS variables
|
|
16
|
+
|
|
17
|
+
Add to your app's entry point (e.g., `layout.tsx`, `_app.tsx`, or `main.tsx`):
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import 'hazo_ui/styles.css';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step 2: Configure Tailwind
|
|
24
|
+
|
|
25
|
+
Update your `tailwind.config.ts`:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import hazoUiPreset from 'hazo_ui/tailwind-preset';
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
presets: [hazoUiPreset],
|
|
32
|
+
content: [
|
|
33
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
34
|
+
'./node_modules/hazo_ui/dist/**/*.js', // Required: scan hazo_ui components
|
|
35
|
+
],
|
|
36
|
+
// ... your other config
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
That's it! The components will now render correctly with proper styling.
|
|
41
|
+
|
|
42
|
+
> **Note**: If you already have shadcn/ui configured with CSS variables, you may skip Step 1 as the variables are compatible.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
11
46
|
## Components
|
|
12
47
|
|
|
13
48
|
### Component Overview
|
|
@@ -151,6 +186,8 @@ function DataTable() {
|
|
|
151
186
|
availableFields={availableFields}
|
|
152
187
|
onFilterChange={handleFilterChange}
|
|
153
188
|
initialFilters={filters}
|
|
189
|
+
title="Filter Products" // Optional: customize dialog title (default: "Filter")
|
|
190
|
+
description="Filter by product attributes" // Optional: customize description
|
|
154
191
|
/>
|
|
155
192
|
{/* Your table/grid component */}
|
|
156
193
|
</div>
|
|
@@ -158,6 +195,16 @@ function DataTable() {
|
|
|
158
195
|
}
|
|
159
196
|
```
|
|
160
197
|
|
|
198
|
+
#### Props
|
|
199
|
+
|
|
200
|
+
| Prop | Type | Required | Default | Description |
|
|
201
|
+
|------|------|----------|---------|-------------|
|
|
202
|
+
| `availableFields` | `FilterField[]` | Yes | - | Array of field definitions for filtering |
|
|
203
|
+
| `onFilterChange` | `(filters: FilterConfig[]) => void` | Yes | - | Callback when filters are applied |
|
|
204
|
+
| `initialFilters` | `FilterConfig[]` | No | `[]` | Initial filter configuration |
|
|
205
|
+
| `title` | `string` | No | `"Filter"` | Dialog title text |
|
|
206
|
+
| `description` | `string` | No | `"Add multiple fields to filter by..."` | Dialog description text |
|
|
207
|
+
|
|
161
208
|
#### Example Input
|
|
162
209
|
|
|
163
210
|
```tsx
|
|
@@ -325,6 +372,8 @@ function DataTable() {
|
|
|
325
372
|
availableFields={availableFields}
|
|
326
373
|
onSortChange={handleSortChange}
|
|
327
374
|
initialSortFields={sorts}
|
|
375
|
+
title="Sort Products" // Optional: customize dialog title (default: "Sort")
|
|
376
|
+
description="Drag to reorder sort priority" // Optional: customize description
|
|
328
377
|
/>
|
|
329
378
|
{/* Your table/grid component */}
|
|
330
379
|
</div>
|
|
@@ -332,6 +381,16 @@ function DataTable() {
|
|
|
332
381
|
}
|
|
333
382
|
```
|
|
334
383
|
|
|
384
|
+
#### Props
|
|
385
|
+
|
|
386
|
+
| Prop | Type | Required | Default | Description |
|
|
387
|
+
|------|------|----------|---------|-------------|
|
|
388
|
+
| `availableFields` | `SortField[]` | Yes | - | Array of field definitions for sorting |
|
|
389
|
+
| `onSortChange` | `(sorts: SortConfig[]) => void` | Yes | - | Callback when sorts are applied |
|
|
390
|
+
| `initialSortFields` | `SortConfig[]` | No | `[]` | Initial sort configuration |
|
|
391
|
+
| `title` | `string` | No | `"Sort"` | Dialog title text |
|
|
392
|
+
| `description` | `string` | No | `"Add multiple fields to sort by..."` | Dialog description text |
|
|
393
|
+
|
|
335
394
|
#### Example Input
|
|
336
395
|
|
|
337
396
|
```tsx
|
package/dist/index.cjs
CHANGED
|
@@ -263,7 +263,7 @@ var CommandItem = React6__namespace.forwardRef(({ className, onSelect, value, ..
|
|
|
263
263
|
{
|
|
264
264
|
ref,
|
|
265
265
|
className: cn(
|
|
266
|
-
"relative flex cursor-
|
|
266
|
+
"relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
267
267
|
className
|
|
268
268
|
),
|
|
269
269
|
onClick: handleClick,
|
|
@@ -665,7 +665,9 @@ function FilterFieldItem({
|
|
|
665
665
|
function HazoUiMultiFilterDialog({
|
|
666
666
|
availableFields,
|
|
667
667
|
onFilterChange,
|
|
668
|
-
initialFilters = []
|
|
668
|
+
initialFilters = [],
|
|
669
|
+
title = "Filter",
|
|
670
|
+
description = "Add multiple fields to filter by. Select a field and set its filter value."
|
|
669
671
|
}) {
|
|
670
672
|
const [isOpen, setIsOpen] = React6.useState(false);
|
|
671
673
|
const [filterFields, setFilterFields] = React6.useState(initialFilters);
|
|
@@ -787,8 +789,8 @@ function HazoUiMultiFilterDialog({
|
|
|
787
789
|
] }) }),
|
|
788
790
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "cls_filter_dialog_content max-w-lg w-full max-h-[90vh] overflow-y-auto", children: [
|
|
789
791
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
790
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children:
|
|
791
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children:
|
|
792
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: description })
|
|
792
794
|
] }),
|
|
793
795
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cls_filter_dialog_body space-y-4 py-4", children: [
|
|
794
796
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cls_add_field_section", children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isComboboxOpen, onOpenChange: setIsComboboxOpen, children: [
|
|
@@ -985,7 +987,9 @@ function SortableSortFieldItem({
|
|
|
985
987
|
function HazoUiMultiSortDialog({
|
|
986
988
|
availableFields,
|
|
987
989
|
onSortChange,
|
|
988
|
-
initialSortFields = []
|
|
990
|
+
initialSortFields = [],
|
|
991
|
+
title = "Sort",
|
|
992
|
+
description = "Add multiple fields to sort by and reorder them. Use the switch to toggle between ascending and descending."
|
|
989
993
|
}) {
|
|
990
994
|
const [isOpen, setIsOpen] = React6.useState(false);
|
|
991
995
|
const [sortFields, setSortFields] = React6.useState(initialSortFields);
|
|
@@ -1089,8 +1093,8 @@ function HazoUiMultiSortDialog({
|
|
|
1089
1093
|
] }) }),
|
|
1090
1094
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "cls_sort_dialog_content max-w-lg", children: [
|
|
1091
1095
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
1092
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children:
|
|
1093
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children:
|
|
1096
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
|
|
1097
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: description })
|
|
1094
1098
|
] }),
|
|
1095
1099
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cls_sort_dialog_body space-y-4 py-4", children: [
|
|
1096
1100
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cls_add_field_section", children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isComboboxOpen, onOpenChange: setIsComboboxOpen, children: [
|