@yca-software/yca-react-core 0.0.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/README.md +129 -0
- package/dist/admin/index.d.ts +10 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin-BVYdWtEy.d.ts +3 -0
- package/dist/api/index.d.ts +68 -0
- package/dist/api/index.js +3 -0
- package/dist/api/index.js.map +1 -0
- package/dist/auth/index.d.ts +49 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/chunk-2HJO2ICF.js +339 -0
- package/dist/chunk-2HJO2ICF.js.map +1 -0
- package/dist/chunk-3AYG73DK.js +174 -0
- package/dist/chunk-3AYG73DK.js.map +1 -0
- package/dist/chunk-3SCZ4Z6P.js +26 -0
- package/dist/chunk-3SCZ4Z6P.js.map +1 -0
- package/dist/chunk-3ZLODBRJ.js +21 -0
- package/dist/chunk-3ZLODBRJ.js.map +1 -0
- package/dist/chunk-6LO5O4G6.js +224 -0
- package/dist/chunk-6LO5O4G6.js.map +1 -0
- package/dist/chunk-APZVW5SW.js +75 -0
- package/dist/chunk-APZVW5SW.js.map +1 -0
- package/dist/chunk-EVZBADFR.js +583 -0
- package/dist/chunk-EVZBADFR.js.map +1 -0
- package/dist/chunk-GXWVFQCK.js +52 -0
- package/dist/chunk-GXWVFQCK.js.map +1 -0
- package/dist/chunk-KG4JVAKS.js +13 -0
- package/dist/chunk-KG4JVAKS.js.map +1 -0
- package/dist/chunk-KZH56VPP.js +183 -0
- package/dist/chunk-KZH56VPP.js.map +1 -0
- package/dist/chunk-LP7Q75C6.js +96 -0
- package/dist/chunk-LP7Q75C6.js.map +1 -0
- package/dist/chunk-NL4NAHXG.js +3 -0
- package/dist/chunk-NL4NAHXG.js.map +1 -0
- package/dist/chunk-PLSNCPEC.js +2507 -0
- package/dist/chunk-PLSNCPEC.js.map +1 -0
- package/dist/chunk-QFKVPVFC.js +1391 -0
- package/dist/chunk-QFKVPVFC.js.map +1 -0
- package/dist/chunk-TSXUUD64.js +64 -0
- package/dist/chunk-TSXUUD64.js.map +1 -0
- package/dist/chunk-UCJ76BEC.js +32 -0
- package/dist/chunk-UCJ76BEC.js.map +1 -0
- package/dist/chunk-WFTIYYII.js +3 -0
- package/dist/chunk-WFTIYYII.js.map +1 -0
- package/dist/components/forms/index.d.ts +101 -0
- package/dist/components/forms/index.js +7 -0
- package/dist/components/forms/index.js.map +1 -0
- package/dist/components/marketing/index.d.ts +473 -0
- package/dist/components/marketing/index.js +5 -0
- package/dist/components/marketing/index.js.map +1 -0
- package/dist/components/spa/index.d.ts +275 -0
- package/dist/components/spa/index.js +8 -0
- package/dist/components/spa/index.js.map +1 -0
- package/dist/components/ui/index.d.ts +420 -0
- package/dist/components/ui/index.js +6 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +4 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/cookies-ZS_QYOR7.d.ts +8 -0
- package/dist/dateRangePickerTranslations-B99F2WQA.d.ts +9 -0
- package/dist/errors/index.d.ts +48 -0
- package/dist/errors/index.js +3 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/forms-VpLvEFob.d.ts +18 -0
- package/dist/hooks/index.d.ts +18 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +49 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/pagination-CFqoqiAG.d.ts +10 -0
- package/dist/radix-overlays-BlCr-uem.d.ts +10 -0
- package/dist/styles.css +9 -0
- package/dist/theme/marketing.css +750 -0
- package/dist/theme/tokens.css +115 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types-BuNHOJ1h.d.ts +58 -0
- package/dist/types-CN73TWSY.d.ts +51 -0
- package/dist/useAdminListPage-C4ZTTllP.d.ts +26 -0
- package/package.json +152 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ReactNode } from 'react';
|
|
3
|
+
import { A as AdminDetailErrorKind } from '../../admin-BVYdWtEy.js';
|
|
4
|
+
import { a as AdminListSearchMode } from '../../useAdminListPage-C4ZTTllP.js';
|
|
5
|
+
import { DateRange } from 'react-day-picker';
|
|
6
|
+
import { LucideIcon } from 'lucide-react';
|
|
7
|
+
export { d as dateRangePickerTranslations } from '../../dateRangePickerTranslations-B99F2WQA.js';
|
|
8
|
+
import '@tanstack/react-query';
|
|
9
|
+
import '../../pagination-CFqoqiAG.js';
|
|
10
|
+
import '../../types-BuNHOJ1h.js';
|
|
11
|
+
import 'date-fns';
|
|
12
|
+
|
|
13
|
+
interface AdminDetailPageProps {
|
|
14
|
+
backHref: string;
|
|
15
|
+
backLabel: string;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
errorKind?: AdminDetailErrorKind;
|
|
18
|
+
error?: unknown;
|
|
19
|
+
notFoundMessage: string;
|
|
20
|
+
forbiddenMessage: string;
|
|
21
|
+
loadErrorMessage: string;
|
|
22
|
+
/** App-bound API error formatter (e.g. formatApiError from SPA helpers). */
|
|
23
|
+
formatError?: (error: unknown) => string;
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
headerActions?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/** Reusable admin detail page: back button, loading/error states, content. */
|
|
28
|
+
declare function AdminDetailPage({ backHref, backLabel, isLoading, errorKind, error, notFoundMessage, forbiddenMessage, loadErrorMessage, formatError, children, headerActions, }: AdminDetailPageProps): React$1.JSX.Element;
|
|
29
|
+
|
|
30
|
+
interface AdminListPageColumn<T> {
|
|
31
|
+
key: string;
|
|
32
|
+
header: string;
|
|
33
|
+
render: (item: T) => React.ReactNode;
|
|
34
|
+
/** Column class for alignment/width */
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
interface AdminListPageProps<T> {
|
|
38
|
+
title: string;
|
|
39
|
+
description: string;
|
|
40
|
+
/** Optional actions (e.g. "Create" button) rendered next to the page title. */
|
|
41
|
+
headerActions?: React.ReactNode;
|
|
42
|
+
/** Card header title (e.g. "All Users") */
|
|
43
|
+
cardTitle: string;
|
|
44
|
+
searchPlaceholder: string;
|
|
45
|
+
emptyMessage: string;
|
|
46
|
+
columns: AdminListPageColumn<T>[];
|
|
47
|
+
items: T[];
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
hasNextPage: boolean;
|
|
50
|
+
isFetchingNextPage: boolean;
|
|
51
|
+
loadMoreRef: React.RefObject<HTMLTableRowElement | null>;
|
|
52
|
+
search: string;
|
|
53
|
+
onSearchChange: (value: string) => void;
|
|
54
|
+
onRowClick: (item: T) => void;
|
|
55
|
+
getRowKey: (item: T) => string;
|
|
56
|
+
/** Accessible label for the loading spinner (app i18n). */
|
|
57
|
+
loadingAriaLabel?: string;
|
|
58
|
+
/** `instant` updates query on debounced typing; `submit` requires Search/Clear actions. */
|
|
59
|
+
searchMode?: AdminListSearchMode;
|
|
60
|
+
/** Label for the Search button when `searchMode` is `submit`. */
|
|
61
|
+
searchButtonLabel?: string;
|
|
62
|
+
/** Label for the Clear button when `searchMode` is `submit`. */
|
|
63
|
+
clearButtonLabel?: string;
|
|
64
|
+
/** Called when the user clicks Search or presses Enter in submit mode. */
|
|
65
|
+
onSearchSubmit?: () => void;
|
|
66
|
+
/** Called when the user clicks Clear in submit mode. */
|
|
67
|
+
onSearchClear?: () => void;
|
|
68
|
+
/** Enter-key handler for submit mode (typically from `useAdminListPage().onSearchKeyDown`). */
|
|
69
|
+
onSearchKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reusable admin list page: search + card + table + infinite scroll.
|
|
73
|
+
*/
|
|
74
|
+
declare function AdminListPage<T>({ title, description, headerActions, cardTitle, searchPlaceholder, emptyMessage, columns, items, isLoading, hasNextPage, isFetchingNextPage, loadMoreRef, search, onSearchChange, onRowClick, getRowKey, loadingAriaLabel, searchMode, searchButtonLabel, clearButtonLabel, onSearchSubmit, onSearchClear, onSearchKeyDown, }: AdminListPageProps<T>): React$1.JSX.Element;
|
|
75
|
+
|
|
76
|
+
type AuditLogFilterOption = {
|
|
77
|
+
value: string;
|
|
78
|
+
label: string;
|
|
79
|
+
};
|
|
80
|
+
type AuditLogListFiltersProps = {
|
|
81
|
+
search: string;
|
|
82
|
+
onSearchChange: (value: string) => void;
|
|
83
|
+
action: string;
|
|
84
|
+
onActionChange: (value: string) => void;
|
|
85
|
+
resourceType: string;
|
|
86
|
+
onResourceTypeChange: (value: string) => void;
|
|
87
|
+
actionOptions: AuditLogFilterOption[];
|
|
88
|
+
resourceOptions: AuditLogFilterOption[];
|
|
89
|
+
searchPlaceholder: string;
|
|
90
|
+
actionFilterLabel: string;
|
|
91
|
+
resourceFilterLabel: string;
|
|
92
|
+
};
|
|
93
|
+
declare function AuditLogListFilters({ search, onSearchChange, action, onActionChange, resourceType, onResourceTypeChange, actionOptions, resourceOptions, searchPlaceholder, actionFilterLabel, resourceFilterLabel, }: AuditLogListFiltersProps): React$1.JSX.Element;
|
|
94
|
+
|
|
95
|
+
interface QueryStateProps {
|
|
96
|
+
isLoading: boolean;
|
|
97
|
+
isError?: boolean;
|
|
98
|
+
error?: unknown;
|
|
99
|
+
onRetry?: () => void;
|
|
100
|
+
loadingClassName?: string;
|
|
101
|
+
children: React.ReactNode;
|
|
102
|
+
/** App-bound API error formatter (e.g. formatApiError from SPA helpers). */
|
|
103
|
+
formatError?: (error: unknown) => string;
|
|
104
|
+
/** Fallback copy when formatError returns empty. */
|
|
105
|
+
errorDescription?: string;
|
|
106
|
+
retryLabel?: string;
|
|
107
|
+
loadingLabel?: string;
|
|
108
|
+
}
|
|
109
|
+
/** Renders loading/error states for TanStack Query results, then children on success. */
|
|
110
|
+
declare function QueryState({ isLoading, isError, error, onRetry, loadingClassName, children, formatError, errorDescription, retryLabel, loadingLabel, }: QueryStateProps): React$1.JSX.Element;
|
|
111
|
+
|
|
112
|
+
type QueryStateBindings = Pick<QueryStateProps, 'formatError' | 'errorDescription' | 'retryLabel' | 'loadingLabel'>;
|
|
113
|
+
type BoundQueryStateProps = Omit<QueryStateProps, keyof QueryStateBindings>;
|
|
114
|
+
/** Factory for SPA-local i18n/error bindings around shared QueryState. */
|
|
115
|
+
declare function createBoundQueryState(useBindings: () => QueryStateBindings): {
|
|
116
|
+
(props: BoundQueryStateProps): React$1.JSX.Element;
|
|
117
|
+
displayName: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
interface DateRangeFilterProps {
|
|
121
|
+
label: string;
|
|
122
|
+
value: DateRange | undefined;
|
|
123
|
+
onChange: (value: DateRange | undefined) => void;
|
|
124
|
+
onApply: (value: DateRange | undefined) => void;
|
|
125
|
+
minDate?: Date;
|
|
126
|
+
maxDate?: Date;
|
|
127
|
+
className?: string;
|
|
128
|
+
hint?: string;
|
|
129
|
+
/** Layout variant for toolbar vs panel contexts. */
|
|
130
|
+
variant?: 'panel' | 'inline' | 'toolbar';
|
|
131
|
+
/** i18n translate function (e.g. from useTranslationNamespace). */
|
|
132
|
+
t: (key: string) => string;
|
|
133
|
+
/** Namespace prefix for dateRange keys (default: `common`). */
|
|
134
|
+
translationNs?: string;
|
|
135
|
+
}
|
|
136
|
+
declare function DateRangeFilter({ label, value, onChange, onApply, minDate, maxDate, className, hint, variant, t, translationNs, }: DateRangeFilterProps): React$1.JSX.Element;
|
|
137
|
+
|
|
138
|
+
interface DetailField {
|
|
139
|
+
label: string;
|
|
140
|
+
value: React.ReactNode;
|
|
141
|
+
/** Span 2 columns on sm+ */
|
|
142
|
+
span?: 1 | 2;
|
|
143
|
+
}
|
|
144
|
+
type DetailFieldVariant = 'plain' | 'bordered';
|
|
145
|
+
interface DetailFieldListProps {
|
|
146
|
+
fields: DetailField[];
|
|
147
|
+
className?: string;
|
|
148
|
+
/** When `bordered`, each label/value group is shown in a subtle framed cell. */
|
|
149
|
+
fieldVariant?: DetailFieldVariant;
|
|
150
|
+
}
|
|
151
|
+
/** Definition list for detail views. Responsive two-column grid on sm+. */
|
|
152
|
+
declare function DetailFieldList({ fields, className, fieldVariant, }: DetailFieldListProps): React$1.JSX.Element;
|
|
153
|
+
|
|
154
|
+
interface EntityRowAction {
|
|
155
|
+
label: string;
|
|
156
|
+
icon: LucideIcon;
|
|
157
|
+
onClick: () => void;
|
|
158
|
+
variant?: 'default' | 'destructive';
|
|
159
|
+
}
|
|
160
|
+
interface EntityRowProps {
|
|
161
|
+
icon: LucideIcon;
|
|
162
|
+
title: React.ReactNode;
|
|
163
|
+
/** Tooltip for title (when title is truncated). Omit when title is a ReactNode. */
|
|
164
|
+
titleTooltip?: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
/** Secondary line below title (e.g. created date, email) */
|
|
167
|
+
subtitle?: string;
|
|
168
|
+
onClick?: () => void;
|
|
169
|
+
actions?: EntityRowAction[];
|
|
170
|
+
/** Muted styling for archived items */
|
|
171
|
+
archived?: boolean;
|
|
172
|
+
/** Extra content below main block (e.g. key prefix, metadata) */
|
|
173
|
+
children?: React.ReactNode;
|
|
174
|
+
className?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Reusable row for settings entity lists (roles, teams, members, API keys).
|
|
178
|
+
* Consistent layout: icon + title + optional description/subtitle + actions dropdown.
|
|
179
|
+
*/
|
|
180
|
+
declare function EntityRow({ icon: Icon, title, titleTooltip, description, subtitle, onClick, actions, archived, children, className, }: EntityRowProps): React$1.JSX.Element;
|
|
181
|
+
|
|
182
|
+
interface PageLoaderProps {
|
|
183
|
+
className?: string;
|
|
184
|
+
spinnerClassName?: string;
|
|
185
|
+
/**
|
|
186
|
+
* - `page`: full-screen route guard
|
|
187
|
+
* - `route`: lazy route / admin detail suspense (`min-h-[40vh]`)
|
|
188
|
+
* - `section`: in-page block (`py-12`)
|
|
189
|
+
* - `inline`: compact centered spinner (auth cards, nested panels)
|
|
190
|
+
*/
|
|
191
|
+
variant?: 'page' | 'route' | 'section' | 'inline';
|
|
192
|
+
/** Accessible loading text; defaults to i18n `common.loading`. */
|
|
193
|
+
loadingLabel?: string;
|
|
194
|
+
}
|
|
195
|
+
declare function PageLoader({ className, spinnerClassName, variant, loadingLabel, }: PageLoaderProps): React$1.JSX.Element;
|
|
196
|
+
|
|
197
|
+
interface RouteSuspenseProps {
|
|
198
|
+
children: ReactNode;
|
|
199
|
+
loadingLabel?: string;
|
|
200
|
+
}
|
|
201
|
+
/** Suspense boundary for lazy route modules with shared loading UX. */
|
|
202
|
+
declare function RouteSuspense({ children, loadingLabel }: RouteSuspenseProps): React$1.JSX.Element;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Theme store interface for theme state management.
|
|
206
|
+
*/
|
|
207
|
+
interface ThemeStore {
|
|
208
|
+
/** Current theme mode */
|
|
209
|
+
theme: 'light' | 'dark';
|
|
210
|
+
/** Function to update theme */
|
|
211
|
+
setTheme: (theme: 'light' | 'dark') => void;
|
|
212
|
+
}
|
|
213
|
+
/** Default in-memory theme store when no external store is provided. */
|
|
214
|
+
declare function useDefaultThemeStore(): ThemeStore;
|
|
215
|
+
/** Hook to read theme store from ThemeProvider context. */
|
|
216
|
+
declare function useThemeStoreContext(): ThemeStore | null;
|
|
217
|
+
/**
|
|
218
|
+
* Props for the ThemeProvider component.
|
|
219
|
+
*/
|
|
220
|
+
interface ThemeProviderProps {
|
|
221
|
+
/** Child components */
|
|
222
|
+
children: React__default.ReactNode;
|
|
223
|
+
/** Hook function that returns the theme store (e.g., from Zustand) */
|
|
224
|
+
useThemeStore?: () => ThemeStore;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Theme provider component that applies theme classes to the document root.
|
|
228
|
+
* Works with any state management solution via the `useThemeStore` prop.
|
|
229
|
+
* When `useThemeStore` is not provided, uses an internal default store so hooks are always called unconditionally.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```tsx
|
|
233
|
+
* // With Zustand
|
|
234
|
+
* const useThemeStore = () => {
|
|
235
|
+
* const theme = useStore((state) => state.theme);
|
|
236
|
+
* const setTheme = useStore((state) => state.setTheme);
|
|
237
|
+
* return { theme, setTheme };
|
|
238
|
+
* };
|
|
239
|
+
*
|
|
240
|
+
* <ThemeProvider useThemeStore={useThemeStore}>
|
|
241
|
+
* <App />
|
|
242
|
+
* </ThemeProvider>
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
declare function ThemeProvider({ children, useThemeStore: useThemeStoreProp }: ThemeProviderProps): React__default.JSX.Element;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Props for the ThemeToggle component.
|
|
249
|
+
*/
|
|
250
|
+
interface ThemeToggleProps {
|
|
251
|
+
/** Hook function that returns the theme store (e.g., from Zustand) */
|
|
252
|
+
useThemeStore?: () => ThemeStore;
|
|
253
|
+
/** Accessible label for the toggle button */
|
|
254
|
+
ariaLabel?: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Theme toggle button component.
|
|
258
|
+
* Displays a sun icon in dark mode and moon icon in light mode.
|
|
259
|
+
* Toggles between light and dark themes when clicked.
|
|
260
|
+
* When useThemeStore is passed, uses that store; otherwise uses ThemeProvider context or internal default (no conditional hook calls).
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```tsx
|
|
264
|
+
* const useThemeStore = () => {
|
|
265
|
+
* const theme = useStore((state) => state.theme);
|
|
266
|
+
* const setTheme = useStore((state) => state.setTheme);
|
|
267
|
+
* return { theme, setTheme };
|
|
268
|
+
* };
|
|
269
|
+
*
|
|
270
|
+
* <ThemeToggle useThemeStore={useThemeStore} ariaLabel="Toggle theme" />
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
declare function ThemeToggle({ useThemeStore: useThemeStoreProp, ariaLabel, }: ThemeToggleProps): React$1.JSX.Element;
|
|
274
|
+
|
|
275
|
+
export { AdminDetailErrorKind, AdminDetailPage, type AdminDetailPageProps, AdminListPage, type AdminListPageColumn, type AdminListPageProps, AdminListSearchMode, type AuditLogFilterOption, AuditLogListFilters, type AuditLogListFiltersProps, type BoundQueryStateProps, DateRangeFilter, type DateRangeFilterProps, type DetailField, DetailFieldList, type DetailFieldListProps, type DetailFieldVariant, EntityRow, type EntityRowAction, type EntityRowProps, PageLoader, type PageLoaderProps, QueryState, type QueryStateBindings, type QueryStateProps, RouteSuspense, type RouteSuspenseProps, ThemeProvider, type ThemeProviderProps, type ThemeStore, ThemeToggle, type ThemeToggleProps, createBoundQueryState, useDefaultThemeStore, useThemeStoreContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AdminDetailPage, AdminListPage, AuditLogListFilters, DateRangeFilter, DetailFieldList, EntityRow, PageLoader, QueryState, RouteSuspense, ThemeProvider, ThemeToggle, createBoundQueryState, useDefaultThemeStore, useThemeStoreContext } from '../../chunk-EVZBADFR.js';
|
|
2
|
+
import '../../chunk-PLSNCPEC.js';
|
|
3
|
+
import '../../chunk-3AYG73DK.js';
|
|
4
|
+
export { dateRangePickerTranslations } from '../../chunk-UCJ76BEC.js';
|
|
5
|
+
import '../../chunk-TSXUUD64.js';
|
|
6
|
+
import '../../chunk-GXWVFQCK.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|