@telamonjs/ui 1.1.0 → 1.2.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +2 -2
  3. package/dist/components/charts/BarChart.js +5 -1
  4. package/dist/components/dialog/confirm-action-dialog.d.ts +47 -15
  5. package/dist/components/dialog/confirm-action-dialog.js +33 -21
  6. package/dist/components/forms/AdminForm.js +2 -1
  7. package/dist/data/InfiniteList.js +2 -4
  8. package/dist/data/MobileCard.js +4 -1
  9. package/dist/data/VirtualDataTable.js +4 -1
  10. package/dist/data/datatable/TableDesktopView.js +2 -5
  11. package/dist/data/row-click.d.ts +10 -0
  12. package/dist/data/row-click.js +11 -0
  13. package/dist/exports/types-constants.d.ts +1 -1
  14. package/dist/exports/types-constants.js +1 -1
  15. package/dist/i18n/messages/en/index.d.ts +1 -0
  16. package/dist/i18n/messages/en/list.d.ts +1 -0
  17. package/dist/i18n/messages/en/list.js +1 -0
  18. package/dist/i18n/messages/en/queue.js +1 -1
  19. package/dist/i18n/messages/es/index.d.ts +1 -0
  20. package/dist/i18n/messages/es/list.d.ts +1 -0
  21. package/dist/i18n/messages/es/list.js +1 -0
  22. package/dist/i18n/messages/pt-BR/index.d.ts +8 -7
  23. package/dist/i18n/messages/pt-BR/list.d.ts +1 -0
  24. package/dist/i18n/messages/pt-BR/list.js +1 -0
  25. package/dist/i18n/messages/pt-BR/queue.d.ts +7 -7
  26. package/dist/i18n/messages/pt-BR/queue.js +7 -7
  27. package/dist/i18n/use-t.d.ts +8 -7
  28. package/dist/pages/list-page/ListPageTable.d.ts +1 -1
  29. package/dist/pages/list-page/ListPageTable.js +1 -1
  30. package/dist/pages/list-page/useDialogUrlSync.d.ts +10 -4
  31. package/dist/pages/list-page/useDialogUrlSync.js +7 -11
  32. package/dist/queue/components/DispatchJobModal.js +5 -2
  33. package/dist/queue/components/JobDetailPage.d.ts +8 -0
  34. package/dist/queue/components/JobDetailPage.js +19 -11
  35. package/dist/queue/components/QueueDashboard.js +3 -1
  36. package/dist/queue/components/QueueTabbedDashboard.d.ts +2 -1
  37. package/dist/queue/components/QueueTabbedDashboard.js +2 -24
  38. package/dist/queue/components/QueuesTable.js +342 -275
  39. package/dist/queue/components/jobs-list-modal/job-row.js +1 -1
  40. package/dist/queue/components/labels-context.d.ts +9 -1
  41. package/dist/queue/components/labels-context.js +3 -2
  42. package/dist/queue/components/labels-provider.d.ts +11 -0
  43. package/dist/queue/components/labels-provider.js +35 -0
  44. package/dist/queue/components/tabs/ConfiguracaoTab.js +4 -4
  45. package/dist/queue/components/tabs/TempoRealTab.js +24 -6
  46. package/dist/queue/components/tabs/historico/history-job-row.js +1 -1
  47. package/dist/queue/lib/action-message.d.ts +3 -2
  48. package/dist/queue/lib/action-message.js +2 -2
  49. package/dist/queue/types.d.ts +3 -0
  50. package/dist/types/actions.d.ts +9 -1
  51. package/dist/types/crud.d.ts +6 -3
  52. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 790823c: Queue Real-time timeline: rows no longer overlap when a job label is long (for example a contract
8
+ `description` used as the display name). The label truncates with a tooltip, the duration keeps its
9
+ width, and the virtualized rows are measured instead of pinned to a fixed height.
10
+
11
+ ## 1.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 575bf56: `ConfirmActionDialog` covers what apps kept local copies for. All additions are optional; `children` is still the trigger.
16
+
17
+ - `body`: free content between the description and the buttons.
18
+ - `confirmDisabled`: disables only the confirm button, from the caller's state.
19
+ - `pending` + `pendingText`: caller-controlled pending. Passing `pending` (even `false`) means confirming never closes the dialog; the caller closes it when its mutation settles. While `true`, both buttons are disabled, the confirm shows a spinner and `pendingText`, and the dialog cannot be dismissed. Without `pending` the dialog keeps awaiting `onConfirm` and closing on success; `pendingText` labels that pending state too.
20
+ - `title` / `description` accept JSX as well as text or `msg()`.
21
+ - `ConfirmDialogInput` (also used by `confirmDialog.inputs` on row and menu actions) gains `type: 'date'` (native input, `YYYY-MM-DD`) and `validate(value, values) => I18nText | undefined`, shown as the field error and blocking the confirm.
22
+
23
+ Migrating a local `ConfirmActionDialog` / `ConfirmFormDialog` copy (open/onOpenChange, pending, JSX title):
24
+
25
+ | Local prop | Public prop |
26
+ | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
27
+ | `open`, `onOpenChange`, `title`, `description`, `confirmText`, `pendingText`, `pending`, `variant`, `confirmDisabled`, `onConfirm` | same name, same meaning |
28
+ | `children` (content between description and buttons) | `body` |
29
+ | hard-coded "Confirmar" / "Cancelar" | localized defaults (or `confirmText` / `cancelText`) |
30
+
31
+ Behaviour differences: with `pending` set, ESC and the overlay no longer dismiss the dialog while pending (the local copies only disabled Cancel), and a promise rejected by `onConfirm` is shown inside the dialog.
32
+
33
+ - 3276e93: `JobDetailPage` takes `moduleLabels` and `jobLabel`, like `QueueTabbedDashboard`. Its title and module badge now resolve through the dashboard's label precedence (`jobLabel` > contract `displayName` > formatted name), and the contract's `description` shows below the title. The page's enable switch also gets an accessible name.
34
+
35
+ ### Patch Changes
36
+
37
+ - b44aa68: Four fixes reported by consumer apps:
38
+
39
+ - `BarChart` rounds the bar's end in `layout='vertical'` (horizontal bars): `[0, 4, 4, 0]` instead of the top corners.
40
+ - `ListPage`'s empty state no longer says "Start by adding a new item" when the "New" button is hidden (no `form`, no `dialogs.create`, or `permissions.create` denied). It shows the neutral `list.emptyDescriptionNoCreate` message instead; an explicit `list.emptyDescription` still wins and the search/filter "no results" copy is unchanged.
41
+ - The `next-auth` peer is widened from exactly `5.0.0-beta.31` to `^5.0.0-beta.20`, the first v5 beta that accepts Next 15 and React 19 and already has every `next-auth/react` API the package uses.
42
+ - `AdminForm` now spaces its sections in the non-flush layout without tabs (a `display: contents` wrapper kept the form's `space-y-6` from reaching them).
43
+
44
+ - 48df933: ListPage: closing a deep-linked dialog (`?view=<id>`) no longer reopens it when the
45
+ set of dialog URL params changes during the close — e.g. `permissions` enabling
46
+ `edit`/`create` as the session arrives. The first Escape now always closes the dialog
47
+ and clears the param. The URL ↔ dialog sync compares what the URL asks for, not the
48
+ spelling of the configured params.
49
+ - 1a6d140: Queue dashboard polish. The Real-time queue tables fit their panel: they no longer force a 704px minimum width (horizontal scroll, "Actions" cut off, job name hidden next to the "Late" badge); the job name truncates with a tooltip, status badges wrap below it and the action buttons wrap inside their column. Toasts and the Run Job dialog name the job through `jobLabel` instead of the raw id (enable/disable, settings saved, queue actions, dispatch). pt-BR: missing accents in the Run Job dialog messages.
50
+ - 339b47f: Clicking inside a row action's confirm dialog (its title, an `inputs` field) no longer opens the row's view dialog behind it, which left the confirm buttons unclickable. React bubbles clicks from portaled content (dialogs, the "..." menu, popovers) through the component tree, so they reached the row's click handler. `InfiniteList`, `DataTable` (table rows), `VirtualDataTable` and `MobileCard` now only treat clicks inside the row's own DOM as row clicks, and ignore links and form fields as well as buttons and checkboxes. `VirtualDataTable` rows previously reacted to every click, buttons included.
51
+
3
52
  ## 1.1.0
4
53
 
5
54
  ### Minor Changes
package/README.md CHANGED
@@ -24,7 +24,7 @@ pnpm add @telamonjs/ui framer-motion jspdf jspdf-autotable next next-auth papapa
24
24
  | `jspdf` | `^4.2.1` |
25
25
  | `jspdf-autotable` | `^5.0.7` |
26
26
  | `next` | `^15.5.29 \|\| ^16.4.6` |
27
- | `next-auth` | `5.0.0-beta.31` |
27
+ | `next-auth` | `^5.0.0-beta.20` |
28
28
  | `papaparse` | `^5.5.0` |
29
29
  | `react` | `^18.0.0 \|\| ^19.0.0` |
30
30
  | `react-dom` | `^18.0.0 \|\| ^19.0.0` |
@@ -85,7 +85,7 @@ async `loadField`), `'multiselect'`, `'richtext'` and 31 more; there is no
85
85
  | Area | Highlights |
86
86
  | --- | --- |
87
87
  | Pages | `ListPage`, `DetailPage`, `CreatePage`, `EditPage` |
88
- | Dialogs | `CreateDialog`, `EditDialog`, `ViewDialog`, `ViewPortalDialog` (launcher grid, inline per-section editing), `DialogFrame`, `SplitDialogFrame` |
88
+ | Dialogs | `CreateDialog`, `EditDialog`, `ViewDialog`, `ViewPortalDialog` (launcher grid, inline per-section editing), `DialogFrame`, `SplitDialogFrame`, `ConfirmActionDialog` (validated inputs incl. dates, free `body`, dialog- or caller-controlled `pending`) |
89
89
  | Forms | `AdminForm`, `CreateForm`, `EditForm`, `Stepper`, `FileUpload`, `useUnsavedChangesGuard` |
90
90
  | Field system | 36 field types; `registerFieldRenderer` adds your own |
91
91
  | Shell | `AdminShell` (sidebar, breadcrumb, header, Cmd+K palette fed from your menu), `ShellPage`, `AdminTabs`, `ImpersonationBanner` |
@@ -13,6 +13,10 @@ import {
13
13
  } from "recharts";
14
14
  import { cn } from "../../utils/index.js";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
+ var BAR_RADIUS = {
17
+ horizontal: [4, 4, 0, 0],
18
+ vertical: [0, 4, 4, 0]
19
+ };
16
20
  var DEFAULT_COLORS = [
17
21
  "#3b82f6",
18
22
  // blue
@@ -112,7 +116,7 @@ function BarChart({
112
116
  {
113
117
  dataKey: key,
114
118
  fill: colors[index % colors.length],
115
- radius: [4, 4, 0, 0]
119
+ radius: BAR_RADIUS[layout]
116
120
  },
117
121
  key
118
122
  ))
@@ -1,29 +1,48 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { I18nText } from '../../i18n/msg';
2
+ import { type I18nText } from '../../i18n/msg';
3
3
  import type { ConfirmDialogInput } from '../../types/actions';
4
4
  export interface ConfirmActionDialogProps {
5
5
  /** Controlled open state. Omit it (with a `children` trigger) to let the dialog own it */
6
6
  open?: boolean;
7
7
  onOpenChange?: (open: boolean) => void;
8
- /** Element that opens the dialog on click */
8
+ /** Element that opens the dialog on click (the trigger, never content: see `body`) */
9
9
  children?: ReactNode;
10
- /** Default: localized "Confirm action" */
11
- title?: I18nText;
12
- description?: I18nText;
10
+ /** Text, `msg()` or JSX. Default: localized "Confirm action" */
11
+ title?: I18nText | ReactNode;
12
+ /** Text, `msg()` or JSX (phrasing content: it renders inside a `<p>`) */
13
+ description?: I18nText | ReactNode;
14
+ /** Free content between the description and the buttons (fields, a summary, a warning) */
15
+ body?: ReactNode;
13
16
  /** Default: localized "Confirm" */
14
17
  confirmText?: I18nText;
18
+ /** Confirm label while pending. Default: `confirmText` */
19
+ pendingText?: I18nText;
15
20
  /** Default: localized "Cancel" */
16
21
  cancelText?: I18nText;
17
22
  /** `'destructive'` paints the confirm button red */
18
23
  variant?: 'default' | 'destructive';
19
- /** Fields asked before confirming; required ones block the confirm while empty */
24
+ /** Disables only the confirm button, e.g. until a confirmation word is typed */
25
+ confirmDisabled?: boolean;
26
+ /**
27
+ * Caller-controlled pending state (usually `mutation.isPending`). Passing it,
28
+ * even `false`, hands the lifecycle to the caller: confirming never closes
29
+ * the dialog; close it yourself (`open`/`onOpenChange`) when the action
30
+ * settles. While `true`, both buttons are disabled, the confirm shows a
31
+ * spinner and `pendingText`, and the dialog cannot be dismissed.
32
+ */
33
+ pending?: boolean;
34
+ /**
35
+ * Fields asked before confirming; `required` and `validate` block the
36
+ * confirm while they fail
37
+ */
20
38
  inputs?: ConfirmDialogInput[];
21
39
  /**
22
- * Runs on confirm with the `inputs` values (`{}` without inputs). The dialog
23
- * stays open, buttons disabled, while it is pending; it closes when it
24
- * resolves, and stays open showing the error message when it rejects.
25
- * Resolve `false` to stay open without a message (an error you already
26
- * reported, e.g. in a toast).
40
+ * Runs on confirm with the `inputs` values (`{}` without inputs). Without
41
+ * `pending`, the dialog stays open, buttons disabled, while the returned
42
+ * promise is pending; it closes when it resolves, and stays open showing
43
+ * the error message when it rejects. Resolve `false` to stay open without a
44
+ * message (an error you already reported, e.g. in a toast). With `pending`,
45
+ * a rejection still shows its message, but nothing closes the dialog.
27
46
  */
28
47
  onConfirm: (values: Record<string, string>) => unknown;
29
48
  }
@@ -35,12 +54,15 @@ export interface ConfirmActionDialogProps {
35
54
  *
36
55
  * @description
37
56
  * The dialog behind `confirmDialog` on row and menu actions, public for any
38
- * other button. Optional `inputs` (text, textarea, select) are validated and
39
- * handed to `onConfirm`; while `onConfirm` is pending the dialog stays open
40
- * with a spinner, it closes on success and shows the error on failure.
57
+ * other button. Optional `inputs` (text, textarea, select, date) are validated
58
+ * (`required`, `validate`) and handed to `onConfirm`; `body` adds free
59
+ * content. Two pending modes: by default the dialog awaits `onConfirm`
60
+ * (spinner, closes on success, shows the error on failure); with a `pending`
61
+ * prop the caller runs the action and closes the dialog itself.
41
62
  *
42
63
  * @example
43
64
  * ```tsx
65
+ * // The dialog awaits the action
44
66
  * <ConfirmActionDialog
45
67
  * title='Reject request?'
46
68
  * variant='destructive'
@@ -49,6 +71,16 @@ export interface ConfirmActionDialogProps {
49
71
  * >
50
72
  * <Button variant='destructive'>Reject</Button>
51
73
  * </ConfirmActionDialog>
74
+ *
75
+ * // The caller runs a mutation and closes on success
76
+ * <ConfirmActionDialog
77
+ * open={open}
78
+ * onOpenChange={setOpen}
79
+ * title={<>Publish <strong>{name}</strong>?</>}
80
+ * pending={publish.isPending}
81
+ * pendingText='Publishing...'
82
+ * onConfirm={() => publish.mutate(undefined, { onSuccess: () => setOpen(false) })}
83
+ * />
52
84
  * ```
53
85
  */
54
- export declare function ConfirmActionDialog({ open: openProp, onOpenChange, children, title, description, confirmText, cancelText, variant, inputs, onConfirm, }: ConfirmActionDialogProps): import("react").JSX.Element;
86
+ export declare function ConfirmActionDialog({ open: openProp, onOpenChange, children, title, description, body, confirmText, pendingText, cancelText, variant, confirmDisabled, pending: pendingProp, inputs, onConfirm, }: ConfirmActionDialogProps): import("react").JSX.Element;
@@ -25,6 +25,7 @@ import {
25
25
  } from "../../ui/select.js";
26
26
  import { Textarea } from "../../ui/textarea.js";
27
27
  import { useTelamonjsT, useText } from "../../i18n/use-t.js";
28
+ import { isMessageRef } from "../../i18n/msg.js";
28
29
  import { jsx, jsxs } from "react/jsx-runtime";
29
30
  var initialValues = (inputs = []) => Object.fromEntries(inputs.map((i) => [i.name, i.defaultValue ?? ""]));
30
31
  function ConfirmActionDialog({
@@ -33,9 +34,13 @@ function ConfirmActionDialog({
33
34
  children,
34
35
  title,
35
36
  description,
37
+ body,
36
38
  confirmText,
39
+ pendingText,
37
40
  cancelText,
38
41
  variant = "default",
42
+ confirmDisabled = false,
43
+ pending: pendingProp,
39
44
  inputs,
40
45
  onConfirm
41
46
  }) {
@@ -45,18 +50,26 @@ function ConfirmActionDialog({
45
50
  const [innerOpen, setInnerOpen] = useState(false);
46
51
  const open = openProp ?? innerOpen;
47
52
  const [values, setValues] = useState(() => initialValues(inputs));
48
- const [missing, setMissing] = useState([]);
53
+ const [attempted, setAttempted] = useState(false);
49
54
  const [error, setError] = useState(null);
50
- const [pending, setPending] = useState(false);
55
+ const [innerPending, setInnerPending] = useState(false);
56
+ const callerOwnsPending = pendingProp !== void 0;
57
+ const pending = pendingProp ?? innerPending;
51
58
  const [wasOpen, setWasOpen] = useState(open);
52
59
  if (open !== wasOpen) {
53
60
  setWasOpen(open);
54
61
  if (open) {
55
62
  setValues(initialValues(inputs));
56
- setMissing([]);
63
+ setAttempted(false);
57
64
  setError(null);
58
65
  }
59
66
  }
67
+ const node = (value) => isMessageRef(value) ? text(value) : value;
68
+ const fieldError = (input) => {
69
+ const value = values[input.name] ?? "";
70
+ if (input.required && !value.trim()) return t("validation.required");
71
+ return input.validate?.(value, values);
72
+ };
60
73
  const setOpen = (next) => {
61
74
  if (openProp === void 0) setInnerOpen(next);
62
75
  onOpenChange?.(next);
@@ -67,44 +80,42 @@ function ConfirmActionDialog({
67
80
  };
68
81
  const handleConfirm = async (event) => {
69
82
  event.preventDefault();
70
- const empty = (inputs ?? []).filter((i) => i.required && !values[i.name]?.trim()).map((i) => i.name);
71
- setMissing(empty);
72
- if (empty.length > 0) return;
83
+ setAttempted(true);
84
+ if ((inputs ?? []).some((input) => fieldError(input))) return;
73
85
  setError(null);
74
- setPending(true);
86
+ if (!callerOwnsPending) setInnerPending(true);
75
87
  try {
76
88
  const result = await onConfirm(values);
77
- setPending(false);
89
+ if (callerOwnsPending) return;
90
+ setInnerPending(false);
78
91
  if (result !== false) setOpen(false);
79
92
  } catch (err) {
80
- setPending(false);
93
+ if (!callerOwnsPending) setInnerPending(false);
81
94
  setError(
82
95
  err instanceof Error && err.message ? err.message : t("toast.unknownError")
83
96
  );
84
97
  }
85
98
  };
86
- const setValue = (name, value) => {
87
- setValues((prev) => ({ ...prev, [name]: value }));
88
- if (missing.includes(name)) setMissing((prev) => prev.filter((n) => n !== name));
89
- };
99
+ const setValue = (name, value) => setValues((prev) => ({ ...prev, [name]: value }));
90
100
  return /* @__PURE__ */ jsxs(AlertDialog, { open, onOpenChange: handleOpenChange, children: [
91
101
  children && /* @__PURE__ */ jsx(AlertDialogTrigger, { asChild: true, children }),
92
102
  /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
93
103
  /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
94
- /* @__PURE__ */ jsx(AlertDialogTitle, { children: text(title) || t("dialog.confirmActionTitle") }),
95
- description && /* @__PURE__ */ jsx(AlertDialogDescription, { children: text(description) })
104
+ /* @__PURE__ */ jsx(AlertDialogTitle, { children: node(title) || t("dialog.confirmActionTitle") }),
105
+ description && /* @__PURE__ */ jsx(AlertDialogDescription, { children: node(description) })
96
106
  ] }),
107
+ body,
97
108
  inputs && inputs.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: inputs.map((input) => {
98
109
  const id = `${idPrefix}-${input.name}`;
99
110
  const errorId = `${id}-error`;
100
- const invalid = missing.includes(input.name);
111
+ const message = attempted ? fieldError(input) : void 0;
101
112
  const common = {
102
113
  id,
103
114
  name: input.name,
104
115
  required: input.required,
105
116
  disabled: pending,
106
- "aria-invalid": invalid || void 0,
107
- "aria-describedby": invalid ? errorId : void 0
117
+ "aria-invalid": message ? true : void 0,
118
+ "aria-describedby": message ? errorId : void 0
108
119
  };
109
120
  return /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
110
121
  /* @__PURE__ */ jsxs(Label, { htmlFor: id, children: [
@@ -141,11 +152,12 @@ function ConfirmActionDialog({
141
152
  Input,
142
153
  {
143
154
  ...common,
155
+ type: input.type === "date" ? "date" : "text",
144
156
  value: values[input.name] ?? "",
145
157
  onChange: (e) => setValue(input.name, e.target.value)
146
158
  }
147
159
  ),
148
- invalid && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-sm text-destructive", children: t("validation.required") })
160
+ message && /* @__PURE__ */ jsx("p", { id: errorId, className: "text-sm text-destructive", children: text(message) })
149
161
  ] }, input.name);
150
162
  }) }),
151
163
  error && /* @__PURE__ */ jsx(
@@ -163,13 +175,13 @@ function ConfirmActionDialog({
163
175
  AlertDialogAction,
164
176
  {
165
177
  "data-testid": "modal-confirm",
166
- disabled: pending,
178
+ disabled: pending || confirmDisabled,
167
179
  "aria-busy": pending || void 0,
168
180
  className: variant === "destructive" ? "bg-red-500 text-white hover:bg-red-600" : "",
169
181
  onClick: handleConfirm,
170
182
  children: [
171
183
  pending && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": "true" }),
172
- text(confirmText) || t("common.confirm")
184
+ pending && text(pendingText) || text(confirmText) || t("common.confirm")
173
185
  ]
174
186
  }
175
187
  )
@@ -575,7 +575,8 @@ function AdminForm({
575
575
  "div",
576
576
  {
577
577
  className: cn(
578
- flush ? "px-6 pt-4 pb-4 space-y-6" : "contents",
578
+ "space-y-6",
579
+ flush && "px-6 pt-4 pb-4",
579
580
  flush && contentClassName
580
581
  ),
581
582
  children: [
@@ -29,6 +29,7 @@ import {
29
29
  } from "lucide-react";
30
30
  import { Button } from "../ui/button.js";
31
31
  import { cn } from "../utils/index.js";
32
+ import { isOwnRowClick } from "./row-click.js";
32
33
  import { useTranslations } from "next-intl";
33
34
  import { useTelamonjsT, useText } from "../i18n/use-t.js";
34
35
  import { isMessageRef, msg } from "../i18n/msg.js";
@@ -266,10 +267,7 @@ function InfiniteList({
266
267
  onRowClick && "cursor-pointer"
267
268
  ),
268
269
  onClick: (e) => {
269
- const target = e.target;
270
- if (target.closest('input[type="checkbox"]') || target.closest("button"))
271
- return;
272
- onRowClick?.(row.original);
270
+ if (isOwnRowClick(e)) onRowClick?.(row.original);
273
271
  },
274
272
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
275
273
  TableCell,
@@ -15,6 +15,7 @@ import {
15
15
  import { flexRender } from "@tanstack/react-table";
16
16
  import { useTelamonjsT } from "../i18n/use-t.js";
17
17
  import { getColumnLabel } from "./column-label.js";
18
+ import { isOwnRowClick } from "./row-click.js";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  function MobileCardImpl({
20
21
  data,
@@ -59,7 +60,9 @@ function MobileCardImpl({
59
60
  Card,
60
61
  {
61
62
  className: `relative transition-all hover:shadow-md cursor-pointer ${isSelected ? "ring-2 ring-primary" : ""}`,
62
- onClick: () => onSelect?.(data),
63
+ onClick: (e) => {
64
+ if (isOwnRowClick(e)) onSelect?.(data);
65
+ },
63
66
  children: [
64
67
  /* @__PURE__ */ jsx(CardHeader, { className: "pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
65
68
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
@@ -19,6 +19,7 @@ import {
19
19
  TableRow
20
20
  } from "../ui/table.js";
21
21
  import { cn } from "../utils/index.js";
22
+ import { isOwnRowClick } from "./row-click.js";
22
23
  import { jsx, jsxs } from "react/jsx-runtime";
23
24
  function VirtualDataTable({
24
25
  data,
@@ -89,7 +90,9 @@ function VirtualDataTable({
89
90
  "border-b transition-colors hover:bg-muted/50",
90
91
  onRowClick && "cursor-pointer"
91
92
  ),
92
- onClick: () => onRowClick?.(row.original),
93
+ onClick: (e) => {
94
+ if (isOwnRowClick(e)) onRowClick?.(row.original);
95
+ },
93
96
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { className: "py-2", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
94
97
  },
95
98
  row.id
@@ -19,6 +19,7 @@ import { Badge } from "../../ui/badge.js";
19
19
  import { cn } from "../../utils/index.js";
20
20
  import { SkeletonTable } from "../../components/skeletons/SkeletonTable.js";
21
21
  import { getDensityStyles } from "./density.js";
22
+ import { isOwnRowClick } from "../row-click.js";
22
23
  import { jsx, jsxs } from "react/jsx-runtime";
23
24
  function TableDesktopView({
24
25
  table,
@@ -97,11 +98,7 @@ function TableDesktopView({
97
98
  ),
98
99
  "data-state": row.getIsSelected() && "selected",
99
100
  onClick: (e) => {
100
- const target = e.target;
101
- if (target.closest('input[type="checkbox"]') || target.closest("button")) {
102
- return;
103
- }
104
- handleRowClick(row.original);
101
+ if (isOwnRowClick(e)) handleRowClick(row.original);
105
102
  },
106
103
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
107
104
  TableCell,
@@ -0,0 +1,10 @@
1
+ import type { MouseEvent } from 'react';
2
+ /**
3
+ * Whether a click on a clickable row (or card) is a click on the row itself.
4
+ *
5
+ * React bubbles synthetic events through the component tree, not the DOM:
6
+ * a click inside content a cell renders in a portal (a row action's confirm
7
+ * dialog, the "..." menu, a popover) still reaches the row's `onClick`. Only
8
+ * targets inside the row's own DOM count, minus interactive elements.
9
+ */
10
+ export declare function isOwnRowClick(event: MouseEvent<Element>): boolean;
@@ -0,0 +1,11 @@
1
+ // src/data/row-click.ts
2
+ var INTERACTIVE = "button, a[href], input, textarea, select";
3
+ function isOwnRowClick(event) {
4
+ const target = event.target;
5
+ if (!(target instanceof Element)) return false;
6
+ if (!event.currentTarget.contains(target)) return false;
7
+ return !target.closest(INTERACTIVE);
8
+ }
9
+ export {
10
+ isOwnRowClick
11
+ };
@@ -7,4 +7,4 @@ export type { ModuleMetadata, ListConfig, CrudColumnDef, FormConfig, QueryConfig
7
7
  export type { ColorPreset, StatItem, HeaderBadgeConfig, HeaderStatsConfig, DialogHeaderConfig, DialogHeaderProps, StatsGridProps, } from '../types/dialog-header';
8
8
  export type { MenuItem, SingleMenuItem, GroupMenuItem, SeparatorMenuItem, MenuItemType, MenuVariant, IconComponent, } from '../types/menu';
9
9
  export type { Density, GapSize, DialogSize, DialogHeight, FieldLayout, CardFieldLayout, } from '../utils/spacing';
10
- export declare const version = "1.1.0";
10
+ export declare const version = "1.2.1";
@@ -1,6 +1,6 @@
1
1
  // src/exports/types-constants.ts
2
2
  import { createPaginatedResponse, asQueryFn } from "../types/pagination.js";
3
- var version = "1.1.0";
3
+ var version = "1.2.1";
4
4
  export {
5
5
  asQueryFn,
6
6
  createPaginatedResponse,
@@ -51,6 +51,7 @@ export declare const en: {
51
51
  empty: string;
52
52
  emptyDescription: string;
53
53
  emptyDescriptionNewItem: string;
54
+ emptyDescriptionNoCreate: string;
54
55
  noResults: string;
55
56
  noResultsDescription: string;
56
57
  selectAll: string;
@@ -3,6 +3,7 @@ export declare const list: {
3
3
  empty: string;
4
4
  emptyDescription: string;
5
5
  emptyDescriptionNewItem: string;
6
+ emptyDescriptionNoCreate: string;
6
7
  noResults: string;
7
8
  noResultsDescription: string;
8
9
  selectAll: string;
@@ -4,6 +4,7 @@ var list = {
4
4
  empty: "No items found",
5
5
  emptyDescription: "Try adjusting the filters or add new items.",
6
6
  emptyDescriptionNewItem: "Start by adding a new item.",
7
+ emptyDescriptionNoCreate: "There are no items to show yet.",
7
8
  noResults: "No results found",
8
9
  noResultsDescription: "Try adjusting the search or the filters.",
9
10
  selectAll: "Select all",
@@ -210,7 +210,7 @@ var queue = {
210
210
  produtoId: "Product ID",
211
211
  tipo: "Query type",
212
212
  smsId: "Scheduled SMS ID",
213
- dataHora: "Specific date/time to process (ISO format). If not informed, processes the previous hour."
213
+ dataHora: "Specific date/time to process (ISO format). If omitted, processes the previous hour."
214
214
  }
215
215
  },
216
216
  jobConfigDialog: {
@@ -51,6 +51,7 @@ export declare const es: {
51
51
  empty: string;
52
52
  emptyDescription: string;
53
53
  emptyDescriptionNewItem: string;
54
+ emptyDescriptionNoCreate: string;
54
55
  noResults: string;
55
56
  noResultsDescription: string;
56
57
  selectAll: string;
@@ -3,6 +3,7 @@ export declare const list: {
3
3
  empty: string;
4
4
  emptyDescription: string;
5
5
  emptyDescriptionNewItem: string;
6
+ emptyDescriptionNoCreate: string;
6
7
  noResults: string;
7
8
  noResultsDescription: string;
8
9
  selectAll: string;
@@ -4,6 +4,7 @@ var list = {
4
4
  empty: "Ning\xFAn elemento encontrado",
5
5
  emptyDescription: "Intente ajustar los filtros o agregue nuevos elementos.",
6
6
  emptyDescriptionNewItem: "Comience agregando un nuevo elemento.",
7
+ emptyDescriptionNoCreate: "Todav\xEDa no hay elementos para mostrar.",
7
8
  noResults: "No se encontraron resultados",
8
9
  noResultsDescription: "Intente ajustar la b\xFAsqueda o los filtros.",
9
10
  selectAll: "Seleccionar todos",
@@ -51,6 +51,7 @@ export declare const ptBR: {
51
51
  readonly empty: "Nenhum item encontrado";
52
52
  readonly emptyDescription: "Tente ajustar os filtros ou adicione novos itens.";
53
53
  readonly emptyDescriptionNewItem: "Comece adicionando um novo item.";
54
+ readonly emptyDescriptionNoCreate: "Ainda não há itens para exibir.";
54
55
  readonly noResults: "Nenhum resultado encontrado";
55
56
  readonly noResultsDescription: "Tente ajustar a busca ou os filtros.";
56
57
  readonly selectAll: "Selecionar todos";
@@ -767,9 +768,9 @@ export declare const ptBR: {
767
768
  };
768
769
  readonly dispatch: {
769
770
  readonly invalidJson: "JSON inválido";
770
- readonly notDispatchable: "Este job nao pode ser disparado manualmente";
771
- readonly requiredFields: "Campos obrigatorios: {fields}";
772
- readonly dispatched: "Job {name} adicionado a fila";
771
+ readonly notDispatchable: "Este job não pode ser disparado manualmente";
772
+ readonly requiredFields: "Campos obrigatórios: {fields}";
773
+ readonly dispatched: "Job {name} adicionado à fila";
773
774
  readonly dispatchedId: "ID: {id}";
774
775
  readonly dispatchError: "Erro ao disparar job";
775
776
  readonly unknownError: "Erro desconhecido";
@@ -777,16 +778,16 @@ export declare const ptBR: {
777
778
  readonly subtitle: "Disparo manual";
778
779
  readonly close: "Fechar";
779
780
  readonly queueLabel: "Queue: {name}";
780
- readonly notDispatchableInfo: "Este job nao pode ser disparado manualmente. Ele e executado automaticamente pelo sistema (cron, eventos, etc.).";
781
+ readonly notDispatchableInfo: "Este job não pode ser disparado manualmente. Ele é executado automaticamente pelo sistema (cron, eventos, etc.).";
781
782
  readonly inputDataTitle: "Dados de Entrada";
782
- readonly formMode: "Formulario";
783
+ readonly formMode: "Formulário";
783
784
  readonly jsonMode: "JSON";
784
- readonly noInputNeeded: "Este job nao requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
785
+ readonly noInputNeeded: "Este job não requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
785
786
  readonly executeNow: "Executar Agora";
786
787
  readonly defaultFields: {
787
788
  readonly rotaId: "ID da rota a processar";
788
789
  readonly ids: "Array de IDs para processar";
789
- readonly relatorioId: "ID do relatorio";
790
+ readonly relatorioId: "ID do relatório";
790
791
  readonly produtoId: "ID do produto";
791
792
  readonly tipo: "Tipo de consulta";
792
793
  readonly smsId: "ID do SMS agendado";
@@ -3,6 +3,7 @@ export declare const list: {
3
3
  readonly empty: "Nenhum item encontrado";
4
4
  readonly emptyDescription: "Tente ajustar os filtros ou adicione novos itens.";
5
5
  readonly emptyDescriptionNewItem: "Comece adicionando um novo item.";
6
+ readonly emptyDescriptionNoCreate: "Ainda não há itens para exibir.";
6
7
  readonly noResults: "Nenhum resultado encontrado";
7
8
  readonly noResultsDescription: "Tente ajustar a busca ou os filtros.";
8
9
  readonly selectAll: "Selecionar todos";
@@ -4,6 +4,7 @@ var list = {
4
4
  empty: "Nenhum item encontrado",
5
5
  emptyDescription: "Tente ajustar os filtros ou adicione novos itens.",
6
6
  emptyDescriptionNewItem: "Comece adicionando um novo item.",
7
+ emptyDescriptionNoCreate: "Ainda n\xE3o h\xE1 itens para exibir.",
7
8
  noResults: "Nenhum resultado encontrado",
8
9
  noResultsDescription: "Tente ajustar a busca ou os filtros.",
9
10
  selectAll: "Selecionar todos",
@@ -186,9 +186,9 @@ export declare const queue: {
186
186
  };
187
187
  readonly dispatch: {
188
188
  readonly invalidJson: "JSON inválido";
189
- readonly notDispatchable: "Este job nao pode ser disparado manualmente";
190
- readonly requiredFields: "Campos obrigatorios: {fields}";
191
- readonly dispatched: "Job {name} adicionado a fila";
189
+ readonly notDispatchable: "Este job não pode ser disparado manualmente";
190
+ readonly requiredFields: "Campos obrigatórios: {fields}";
191
+ readonly dispatched: "Job {name} adicionado à fila";
192
192
  readonly dispatchedId: "ID: {id}";
193
193
  readonly dispatchError: "Erro ao disparar job";
194
194
  readonly unknownError: "Erro desconhecido";
@@ -196,16 +196,16 @@ export declare const queue: {
196
196
  readonly subtitle: "Disparo manual";
197
197
  readonly close: "Fechar";
198
198
  readonly queueLabel: "Queue: {name}";
199
- readonly notDispatchableInfo: "Este job nao pode ser disparado manualmente. Ele e executado automaticamente pelo sistema (cron, eventos, etc.).";
199
+ readonly notDispatchableInfo: "Este job não pode ser disparado manualmente. Ele é executado automaticamente pelo sistema (cron, eventos, etc.).";
200
200
  readonly inputDataTitle: "Dados de Entrada";
201
- readonly formMode: "Formulario";
201
+ readonly formMode: "Formulário";
202
202
  readonly jsonMode: "JSON";
203
- readonly noInputNeeded: "Este job nao requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
203
+ readonly noInputNeeded: "Este job não requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
204
204
  readonly executeNow: "Executar Agora";
205
205
  readonly defaultFields: {
206
206
  readonly rotaId: "ID da rota a processar";
207
207
  readonly ids: "Array de IDs para processar";
208
- readonly relatorioId: "ID do relatorio";
208
+ readonly relatorioId: "ID do relatório";
209
209
  readonly produtoId: "ID do produto";
210
210
  readonly tipo: "Tipo de consulta";
211
211
  readonly smsId: "ID do SMS agendado";