@marktiderman/genesis-ui 1.1.0 → 1.2.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/dist/{chunk-X7KMF6NH.js → chunk-IP6TMT3D.js} +3 -3
- package/dist/{chunk-X7KMF6NH.js.map → chunk-IP6TMT3D.js.map} +1 -1
- package/dist/{chunk-MUQLZFUR.js → chunk-NPNADZHM.js} +11 -5
- package/dist/chunk-NPNADZHM.js.map +1 -0
- package/dist/{chunk-CLK7JBZJ.js → chunk-QLCDAFS7.js} +2 -2
- package/dist/chunk-QLCDAFS7.js.map +1 -0
- package/dist/{chunk-6V4GJUE3.js → chunk-QSXVL5UB.js} +4 -3
- package/dist/chunk-QSXVL5UB.js.map +1 -0
- package/dist/{chunk-AIODTBWP.js → chunk-T5VX5DYO.js} +3 -2
- package/dist/chunk-T5VX5DYO.js.map +1 -0
- package/dist/chunk-YETMISCE.js +23 -0
- package/dist/chunk-YETMISCE.js.map +1 -0
- package/dist/components/data/index.d.ts +4 -6
- package/dist/components/data/index.js +14 -17
- package/dist/components/data/index.js.map +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/form-field.js +2 -2
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/use-resource-page.d.ts +2 -2
- package/dist/hooks/use-resource-page.js +1 -1
- package/dist/index.js +26 -26
- package/dist/{use-resource-page-BzvUM8de.d.ts → use-resource-page-B-CFcikK.d.ts} +1 -1
- package/package.json +6 -2
- package/dist/chunk-4HUKJSKC.js +0 -51
- package/dist/chunk-4HUKJSKC.js.map +0 -1
- package/dist/chunk-6V4GJUE3.js.map +0 -1
- package/dist/chunk-A5WHNNXJ.js +0 -22
- package/dist/chunk-A5WHNNXJ.js.map +0 -1
- package/dist/chunk-AIODTBWP.js.map +0 -1
- package/dist/chunk-CLK7JBZJ.js.map +0 -1
- package/dist/chunk-F2JB7YFF.js +0 -341
- package/dist/chunk-F2JB7YFF.js.map +0 -1
- package/dist/chunk-IKIFQILN.js +0 -124
- package/dist/chunk-IKIFQILN.js.map +0 -1
- package/dist/chunk-JEECTX26.js +0 -20
- package/dist/chunk-JEECTX26.js.map +0 -1
- package/dist/chunk-MUQLZFUR.js.map +0 -1
- package/dist/chunk-W64GERJW.js +0 -22
- package/dist/chunk-W64GERJW.js.map +0 -1
- package/dist/hooks/use-one.d.ts +0 -18
- package/dist/hooks/use-one.js +0 -4
- package/dist/hooks/use-one.js.map +0 -1
- package/dist/hooks/use-resource-form.d.ts +0 -37
- package/dist/hooks/use-resource-form.js +0 -7
- package/dist/hooks/use-resource-form.js.map +0 -1
- package/dist/hooks/use-resource.d.ts +0 -46
- package/dist/hooks/use-resource.js +0 -4
- package/dist/hooks/use-resource.js.map +0 -1
- package/dist/hooks/use-wizard.d.ts +0 -25
- package/dist/hooks/use-wizard.js +0 -3
- package/dist/hooks/use-wizard.js.map +0 -1
- package/dist/types-HIZY7zxO.d.ts +0 -61
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
3
|
-
import { ResourceFormFieldDef } from '@marktiderman/genesis-core';
|
|
4
|
-
|
|
5
|
-
interface UseResourceFormOptions {
|
|
6
|
-
resource: string;
|
|
7
|
-
action: "create" | "edit";
|
|
8
|
-
id?: string;
|
|
9
|
-
initialData?: Record<string, unknown>;
|
|
10
|
-
fields?: ResourceFormFieldDef[];
|
|
11
|
-
/** Full dataset used to auto-detect select fields from unique values. */
|
|
12
|
-
listData?: Record<string, unknown>[];
|
|
13
|
-
onSuccess?: (data: Record<string, unknown>) => void;
|
|
14
|
-
onError?: (error: Error) => void;
|
|
15
|
-
/** Pre-fill create form defaults from URL query params. Default true. */
|
|
16
|
-
prefillFromUrl?: boolean;
|
|
17
|
-
/** Validation trigger mode. Default "onBlur". */
|
|
18
|
-
validationMode?: "onBlur" | "onChange" | "onSubmit";
|
|
19
|
-
/** Enable autosave drafts to localStorage for create mode. */
|
|
20
|
-
autosave?: boolean | {
|
|
21
|
-
debounceMs?: number;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
interface UseResourceFormReturn {
|
|
25
|
-
form: UseFormReturn<Record<string, unknown>>;
|
|
26
|
-
resolvedFields: ResourceFormFieldDef[];
|
|
27
|
-
onSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;
|
|
28
|
-
/** Raw save handler — use with form.handleSubmit(handleSave, onInvalid). */
|
|
29
|
-
handleSave: (data: Record<string, unknown>) => Promise<void>;
|
|
30
|
-
isSaving: boolean;
|
|
31
|
-
isLoading: boolean;
|
|
32
|
-
}
|
|
33
|
-
/** Build default values for a single array item from its sub-field definitions */
|
|
34
|
-
declare function buildArrayItemDefaults(arrayFields: ResourceFormFieldDef[]): Record<string, unknown>;
|
|
35
|
-
declare function useResourceForm(options: UseResourceFormOptions): UseResourceFormReturn;
|
|
36
|
-
|
|
37
|
-
export { type UseResourceFormOptions, type UseResourceFormReturn, buildArrayItemDefaults, useResourceForm };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { buildArrayItemDefaults, useResourceForm } from '../chunk-F2JB7YFF.js';
|
|
2
|
-
import '../chunk-CLK7JBZJ.js';
|
|
3
|
-
import '../chunk-XISSLIMH.js';
|
|
4
|
-
import '../chunk-A5WHNNXJ.js';
|
|
5
|
-
import '../chunk-JEECTX26.js';
|
|
6
|
-
//# sourceMappingURL=use-resource-form.js.map
|
|
7
|
-
//# sourceMappingURL=use-resource-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-resource-form.js"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import { S as SortParam, F as FilterParam, L as ListResult, a as ListParams, I as Identifier } from '../types-HIZY7zxO.js';
|
|
3
|
-
|
|
4
|
-
interface UseResourceOptions<T> {
|
|
5
|
-
defaultSort?: SortParam;
|
|
6
|
-
defaultFilters?: FilterParam[];
|
|
7
|
-
defaultPerPage?: number;
|
|
8
|
-
/** Supabase select/join syntax, e.g. "*, author:profiles(name)". */
|
|
9
|
-
select?: string;
|
|
10
|
-
/** Fields to search across when setSearch is called. Required for server-side search. */
|
|
11
|
-
searchFields?: string[];
|
|
12
|
-
/** Disable auto-fetching. */
|
|
13
|
-
enabled?: boolean;
|
|
14
|
-
onCreateSuccess?: (data: T) => void;
|
|
15
|
-
onUpdateSuccess?: (data: T) => void;
|
|
16
|
-
onDeleteSuccess?: () => void;
|
|
17
|
-
onError?: (error: Error) => void;
|
|
18
|
-
}
|
|
19
|
-
interface UseResourceReturn<T> {
|
|
20
|
-
/** TanStack Query result for the list query. */
|
|
21
|
-
list: UseQueryResult<ListResult<T>>;
|
|
22
|
-
/** Current list params (pagination, sort, filters, search). */
|
|
23
|
-
params: ListParams;
|
|
24
|
-
setSort: (sort: SortParam) => void;
|
|
25
|
-
setFilters: (filters: FilterParam[]) => void;
|
|
26
|
-
setPage: (page: number) => void;
|
|
27
|
-
setPerPage: (perPage: number) => void;
|
|
28
|
-
setSearch: (query: string) => void;
|
|
29
|
-
/** Create a new record. Returns the created item. */
|
|
30
|
-
create: (data: Partial<T>) => Promise<T>;
|
|
31
|
-
/** Update an existing record by id. Returns the updated item. */
|
|
32
|
-
update: (id: Identifier, data: Partial<T>) => Promise<T>;
|
|
33
|
-
/** Delete a record by id. */
|
|
34
|
-
remove: (id: Identifier) => Promise<void>;
|
|
35
|
-
/** True when any mutation is in-flight. */
|
|
36
|
-
isMutating: boolean;
|
|
37
|
-
createMutation: UseMutationResult<T, Error, Partial<T>>;
|
|
38
|
-
updateMutation: UseMutationResult<T, Error, {
|
|
39
|
-
id: Identifier;
|
|
40
|
-
data: Partial<T>;
|
|
41
|
-
}>;
|
|
42
|
-
deleteMutation: UseMutationResult<void, Error, Identifier>;
|
|
43
|
-
}
|
|
44
|
-
declare function useResource<T = Record<string, unknown>>(resource: string, options?: UseResourceOptions<T>): UseResourceReturn<T>;
|
|
45
|
-
|
|
46
|
-
export { type UseResourceOptions, type UseResourceReturn, useResource };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-resource.js"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
|
2
|
-
|
|
3
|
-
interface WizardStep {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
/** Field keys belonging to this step. */
|
|
8
|
-
fields: string[];
|
|
9
|
-
}
|
|
10
|
-
interface UseWizardReturn {
|
|
11
|
-
currentStep: number;
|
|
12
|
-
currentStepDef: WizardStep;
|
|
13
|
-
totalSteps: number;
|
|
14
|
-
/** Progress from 0 to 1. */
|
|
15
|
-
progress: number;
|
|
16
|
-
isFirst: boolean;
|
|
17
|
-
isLast: boolean;
|
|
18
|
-
/** Validate current step fields, advance if valid. Returns true if valid. */
|
|
19
|
-
next: () => Promise<boolean>;
|
|
20
|
-
back: () => void;
|
|
21
|
-
goTo: (step: number) => void;
|
|
22
|
-
}
|
|
23
|
-
declare function useWizard(steps: WizardStep[], form: UseFormReturn<Record<string, unknown>>): UseWizardReturn;
|
|
24
|
-
|
|
25
|
-
export { type UseWizardReturn, type WizardStep, useWizard };
|
package/dist/hooks/use-wizard.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"use-wizard.js"}
|
package/dist/types-HIZY7zxO.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/** Record identifier — supports both string UUIDs and numeric auto-increment IDs. */
|
|
2
|
-
type Identifier = string | number;
|
|
3
|
-
/** Pagination parameters (offset-based, with optional cursor for future use). */
|
|
4
|
-
interface PaginationParam {
|
|
5
|
-
page: number;
|
|
6
|
-
perPage: number;
|
|
7
|
-
cursor?: string;
|
|
8
|
-
}
|
|
9
|
-
/** Sort direction for a single field. */
|
|
10
|
-
interface SortParam {
|
|
11
|
-
field: string;
|
|
12
|
-
order: "asc" | "desc";
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Filter expressions — discriminated union by operator.
|
|
16
|
-
* Filters are AND-ed together in queries.
|
|
17
|
-
*/
|
|
18
|
-
/** Operators that compare a field against a single scalar value. */
|
|
19
|
-
interface ScalarFilter {
|
|
20
|
-
field: string;
|
|
21
|
-
operator: "eq" | "neq" | "gt" | "lt" | "gte" | "lte" | "contains";
|
|
22
|
-
value: string | number | boolean;
|
|
23
|
-
}
|
|
24
|
-
/** Operator that checks field membership in a list. */
|
|
25
|
-
interface ArrayFilter {
|
|
26
|
-
field: string;
|
|
27
|
-
operator: "in";
|
|
28
|
-
value: (string | number | boolean)[];
|
|
29
|
-
}
|
|
30
|
-
/** Operator that checks field is within a range. */
|
|
31
|
-
interface RangeFilter {
|
|
32
|
-
field: string;
|
|
33
|
-
operator: "between";
|
|
34
|
-
value: [string | number, string | number];
|
|
35
|
-
}
|
|
36
|
-
/** Operators that check for null/non-null — no value needed. */
|
|
37
|
-
interface NullFilter {
|
|
38
|
-
field: string;
|
|
39
|
-
operator: "is_null" | "is_not_null";
|
|
40
|
-
}
|
|
41
|
-
type FilterParam = ScalarFilter | ArrayFilter | RangeFilter | NullFilter;
|
|
42
|
-
/** Parameters for `getList`. */
|
|
43
|
-
interface ListParams {
|
|
44
|
-
pagination?: PaginationParam;
|
|
45
|
-
sort?: SortParam;
|
|
46
|
-
filters?: FilterParam[];
|
|
47
|
-
/** Supabase select syntax, e.g. "*, author:profiles(name)". Mock provider ignores this. */
|
|
48
|
-
select?: string;
|
|
49
|
-
/** Multi-field text search (case-insensitive). */
|
|
50
|
-
search?: {
|
|
51
|
-
query: string;
|
|
52
|
-
fields: string[];
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/** Result of `getList`. */
|
|
56
|
-
interface ListResult<T> {
|
|
57
|
-
data: T[];
|
|
58
|
-
total: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export type { FilterParam as F, Identifier as I, ListResult as L, SortParam as S, ListParams as a };
|