@telamonjs/ui 1.2.1 → 1.3.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist/components/data/DataTableActions.js +1 -0
  4. package/dist/components/data/action-access.d.ts +9 -2
  5. package/dist/components/data/action-access.js +10 -3
  6. package/dist/components/dialog/CrudDialogShell.d.ts +2 -0
  7. package/dist/components/dialog/CrudDialogShell.js +9 -7
  8. package/dist/components/dialog/DialogLoadingState.d.ts +16 -0
  9. package/dist/components/dialog/DialogLoadingState.js +16 -0
  10. package/dist/components/dialog/confirm-action-dialog.d.ts +12 -4
  11. package/dist/components/dialog/confirm-action-dialog.js +75 -14
  12. package/dist/components/dialog/create-dialog.js +1 -12
  13. package/dist/components/dialog/edit-dialog.js +5 -4
  14. package/dist/components/dialog/index.d.ts +1 -1
  15. package/dist/components/dialog/index.js +1 -2
  16. package/dist/components/dialog/view-dialog.js +5 -4
  17. package/dist/components/utilities/QueryErrorState.d.ts +47 -0
  18. package/dist/components/utilities/QueryErrorState.js +85 -0
  19. package/dist/data/DataTable.d.ts +2 -2
  20. package/dist/data/DataTable.js +2 -0
  21. package/dist/data/ExportMenu.d.ts +30 -3
  22. package/dist/data/ExportMenu.js +69 -5
  23. package/dist/data/datatable/TableToolbar.d.ts +3 -2
  24. package/dist/data/datatable/TableToolbar.js +30 -13
  25. package/dist/data/datatable/types.d.ts +9 -0
  26. package/dist/data/fetch-all-pages.d.ts +30 -0
  27. package/dist/data/fetch-all-pages.js +44 -0
  28. package/dist/exports/data-crud.d.ts +7 -3
  29. package/dist/exports/data-crud.js +4 -0
  30. package/dist/exports/types-constants.d.ts +2 -2
  31. package/dist/exports/types-constants.js +1 -1
  32. package/dist/i18n/messages/en/data.d.ts +3 -0
  33. package/dist/i18n/messages/en/data.js +3 -0
  34. package/dist/i18n/messages/en/index.d.ts +5 -0
  35. package/dist/i18n/messages/en/validation.d.ts +2 -0
  36. package/dist/i18n/messages/en/validation.js +2 -0
  37. package/dist/i18n/messages/es/data.d.ts +3 -0
  38. package/dist/i18n/messages/es/data.js +3 -0
  39. package/dist/i18n/messages/es/index.d.ts +5 -0
  40. package/dist/i18n/messages/es/validation.d.ts +2 -0
  41. package/dist/i18n/messages/es/validation.js +2 -0
  42. package/dist/i18n/messages/pt-BR/data.d.ts +3 -0
  43. package/dist/i18n/messages/pt-BR/data.js +3 -0
  44. package/dist/i18n/messages/pt-BR/index.d.ts +5 -0
  45. package/dist/i18n/messages/pt-BR/validation.d.ts +2 -0
  46. package/dist/i18n/messages/pt-BR/validation.js +2 -0
  47. package/dist/i18n/use-t.d.ts +5 -0
  48. package/dist/pages/ListPage.js +9 -13
  49. package/dist/pages/list-page/ListPageTable.d.ts +4 -2
  50. package/dist/pages/list-page/ListPageTable.js +3 -3
  51. package/dist/pages/list-page/ListPageToolbar.d.ts +4 -1
  52. package/dist/pages/list-page/ListPageToolbar.js +10 -4
  53. package/dist/pages/list-page/apply-crud-permissions.d.ts +4 -1
  54. package/dist/pages/list-page/apply-crud-permissions.js +20 -3
  55. package/dist/pages/list-page/types.d.ts +2 -16
  56. package/dist/pages/list-page/useListPageExport.d.ts +24 -0
  57. package/dist/pages/list-page/useListPageExport.js +54 -0
  58. package/dist/types/actions.d.ts +43 -4
  59. package/dist/types/crud.d.ts +48 -2
  60. package/package.json +1 -1
  61. package/dist/components/dialog/DialogErrorState.d.ts +0 -44
  62. package/dist/components/dialog/DialogErrorState.js +0 -57
@@ -1,44 +0,0 @@
1
- export interface DialogErrorStateProps {
2
- /** Error message to display */
3
- error: string | null;
4
- /** Optional retry callback */
5
- onRetry?: () => void;
6
- /** Optional dismiss callback */
7
- onDismiss?: () => void;
8
- }
9
- /**
10
- * DialogErrorState - Renders error state with optional retry/dismiss actions
11
- *
12
- * Provides consistent error UI across dialogs (view, edit, create).
13
- * Replaces duplicated error Alert rendering logic.
14
- *
15
- * @example
16
- * ```tsx
17
- * // Simple error display
18
- * {error && <DialogErrorState error={error} />}
19
- *
20
- * // With retry callback
21
- * <DialogErrorState
22
- * error={error}
23
- * onRetry={refetch}
24
- * onDismiss={() => setError(null)}
25
- * />
26
- * ```
27
- */
28
- export declare function DialogErrorState({ error, onRetry, onDismiss, }: DialogErrorStateProps): import("react").JSX.Element | null;
29
- export interface DialogLoadingStateProps {
30
- /** Loading message */
31
- message?: string;
32
- }
33
- /**
34
- * DialogLoadingState - Renders loading spinner with optional message.
35
- *
36
- * Consolidates the duplicated loading spinner rendering from EditDialog and ViewDialog.
37
- *
38
- * @example
39
- * ```tsx
40
- * {isLoading && <DialogLoadingState />}
41
- * {isLoading && <DialogLoadingState message="Buscando dados..." />}
42
- * ```
43
- */
44
- export declare function DialogLoadingState({ message }: DialogLoadingStateProps): import("react").JSX.Element;
@@ -1,57 +0,0 @@
1
- "use client";
2
-
3
- // src/components/dialog/DialogErrorState.tsx
4
- import { AlertCircle, Loader2 } from "lucide-react";
5
- import { useTelamonjsT } from "../../i18n/use-t.js";
6
- import { Alert, AlertDescription } from "../../ui/alert.js";
7
- import { Button } from "../../ui/button.js";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- function DialogErrorState({
10
- error,
11
- onRetry,
12
- onDismiss
13
- }) {
14
- const t = useTelamonjsT();
15
- if (!error) return null;
16
- return /* @__PURE__ */ jsx("div", { className: "py-8", children: /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
17
- /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
18
- /* @__PURE__ */ jsxs(AlertDescription, { className: "flex items-center justify-between gap-4", children: [
19
- /* @__PURE__ */ jsx("span", { children: error }),
20
- (onRetry || onDismiss) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
21
- onRetry && /* @__PURE__ */ jsx(
22
- Button,
23
- {
24
- variant: "outline",
25
- size: "sm",
26
- onClick: onRetry,
27
- className: "bg-card hover:bg-muted/50",
28
- "data-testid": "dialog-error-retry-button",
29
- children: t("dialog.retryLabel")
30
- }
31
- ),
32
- onDismiss && /* @__PURE__ */ jsx(
33
- Button,
34
- {
35
- variant: "outline",
36
- size: "sm",
37
- onClick: onDismiss,
38
- className: "bg-card hover:bg-muted/50",
39
- "data-testid": "dialog-error-dismiss-button",
40
- children: t("common.close")
41
- }
42
- )
43
- ] })
44
- ] })
45
- ] }) });
46
- }
47
- function DialogLoadingState({ message }) {
48
- const t = useTelamonjsT();
49
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
50
- /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 animate-spin text-primary" }),
51
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: message ?? t("dialog.loadingData") })
52
- ] });
53
- }
54
- export {
55
- DialogErrorState,
56
- DialogLoadingState
57
- };