@protobase/ui 0.63.3 → 0.63.5

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 (113) hide show
  1. package/dist/account/devices-section.js +1 -1
  2. package/dist/account/passkeys-section.js +1 -1
  3. package/dist/account/staff-sign-in-log.js +1 -1
  4. package/dist/activity-chart/activity-chart.js +2 -2
  5. package/dist/activity-chart/activity-tooltip.js +1 -1
  6. package/dist/app/app.js +1 -1
  7. package/dist/app/change-confirm/use-change-confirm.js +15 -18
  8. package/dist/app/charts/chart-view.js +1 -1
  9. package/dist/app/comments/comment-composer.js +1 -1
  10. package/dist/app/comments/comments-section.js +2 -2
  11. package/dist/app/create/create-record-form.js +1 -1
  12. package/dist/app/custom-section.js +1 -1
  13. package/dist/app/delete/use-delete-flow.js +1 -1
  14. package/dist/app/displays/board-column.js +1 -1
  15. package/dist/app/displays/calendar-display.js +1 -1
  16. package/dist/app/displays/cards-display.js +1 -1
  17. package/dist/app/displays/list-cards.js +1 -1
  18. package/dist/app/displays/timeline-display.js +1 -1
  19. package/dist/app/displays/use-board-move.js +1 -1
  20. package/dist/app/displays/use-calendar-move.js +1 -1
  21. package/dist/app/embedded-list/embedded-list.js +1 -1
  22. package/dist/app/field-editor.js +2 -2
  23. package/dist/app/gallery/gallery-section.js +1 -1
  24. package/dist/app/gallery/photo-details.js +1 -1
  25. package/dist/app/hand-order/hand-sorted-list.js +1 -1
  26. package/dist/app/hand-order/use-hand-order.js +1 -1
  27. package/dist/app/history/history-section.js +1 -1
  28. package/dist/app/incoming-card.js +1 -1
  29. package/dist/app/lines-plan.js +116 -0
  30. package/dist/app/list-edit/use-list-edits.js +1 -1
  31. package/dist/app/list-order.js +7 -1
  32. package/dist/app/new-version/new-version-toast.js +1 -1
  33. package/dist/app/pages/blocks/field.js +1 -1
  34. package/dist/app/pages/blocks/modal-form.js +2 -2
  35. package/dist/app/pages/blocks/settings.js +2 -2
  36. package/dist/app/pages/record-actions.js +1 -1
  37. package/dist/app/pages/use-run-action.js +1 -1
  38. package/dist/app/picker/picker-combobox.js +1 -1
  39. package/dist/app/record-chart/record-chart-section.js +2 -2
  40. package/dist/app/record-lines-cell.js +47 -0
  41. package/dist/app/record-lines.js +103 -26
  42. package/dist/app/record-messages.js +8 -2
  43. package/dist/app/record-page.js +18 -20
  44. package/dist/app/record-row/record-row-body.js +1 -1
  45. package/dist/app/record-row/record-row.js +1 -1
  46. package/dist/app/record-row/saved-record-row.js +1 -1
  47. package/dist/app/related-cards/related-card.js +1 -1
  48. package/dist/app/related-cards/related-cards.js +1 -1
  49. package/dist/app/related-section.js +1 -1
  50. package/dist/app/saved/saved-list.js +1 -1
  51. package/dist/app/searches/saved-search-rows.js +1 -1
  52. package/dist/app/searches/saved-search-section.js +1 -1
  53. package/dist/app/searches/saved-searches.js +1 -1
  54. package/dist/app/searches/search-controls.js +1 -1
  55. package/dist/app/searches/update-search-dialog.js +1 -1
  56. package/dist/app/searches/use-save-search.js +1 -1
  57. package/dist/app/sensitive-field.js +1 -1
  58. package/dist/app/use-lines-draft.js +94 -35
  59. package/dist/app/use-lines.js +21 -7
  60. package/dist/app/use-record-editor.js +15 -10
  61. package/dist/app/use-record-lines.js +47 -0
  62. package/dist/app-shell/profile-menu.js +2 -2
  63. package/dist/auth/forgot-password-form.js +1 -1
  64. package/dist/auth/sign-in-form.js +1 -1
  65. package/dist/calls/call-guests-panel.js +1 -1
  66. package/dist/calls/call-rings.js +1 -1
  67. package/dist/chat/chat-message.js +1 -1
  68. package/dist/data/use-list.d.ts +27 -1
  69. package/dist/data/use-list.js +10 -3
  70. package/dist/data-grid/cell-text.js +3 -3
  71. package/dist/data-grid/cells.js +3 -3
  72. package/dist/data-grid/grid-row.js +1 -1
  73. package/dist/forms/public-form-page.js +1 -1
  74. package/dist/index.js +3 -3
  75. package/dist/inline-child-table/columns.js +7 -2
  76. package/dist/inline-child-table/inline-child-table.js +29 -48
  77. package/dist/inline-child-table/line-row.js +16 -44
  78. package/dist/inline-child-table/messages.js +4 -18
  79. package/dist/notifications/bell/notification-item.js +1 -1
  80. package/dist/organizations/invitation-page.js +1 -1
  81. package/dist/package.js +1 -1
  82. package/dist/primitives/dialog.d.ts +7 -2
  83. package/dist/primitives/dialog.js +9 -4
  84. package/dist/record-view/field.js +1 -1
  85. package/dist/record-view/messages.js +0 -4
  86. package/dist/record-view/record-header.js +2 -2
  87. package/dist/shell/assets/app-BPv_SjnU.js +9 -0
  88. package/dist/shell/assets/{calls-CEW8hdPi.js → calls-CPiQcC70.js} +2 -2
  89. package/dist/shell/assets/index-Or2wt-ck.css +2 -0
  90. package/dist/shell/assets/{index-D7O0sMwH.js → index-_ZpZ2ro0.js} +2 -2
  91. package/dist/shell/assets/{records-map-BIDl1ull.js → records-map-DU29d6QK.js} +2 -2
  92. package/dist/shell/assets/shared-protobase-ui-Cab5nqST.js +2 -0
  93. package/dist/shell/assets/{vendor-xNCj9Gc_.js → vendor-iwLB0x-s.js} +39 -39
  94. package/dist/shell/index.html +5 -5
  95. package/dist/shell/protobase.shell.json +2 -2
  96. package/dist/shell/protobase.sw.js +2 -2
  97. package/dist/shell-source-maps/assets/app-BPv_SjnU.js.map +1 -0
  98. package/dist/shell-source-maps/assets/{calls-CEW8hdPi.js.map → calls-CPiQcC70.js.map} +1 -1
  99. package/dist/shell-source-maps/assets/{index-D7O0sMwH.js.map → index-_ZpZ2ro0.js.map} +1 -1
  100. package/dist/shell-source-maps/assets/{records-map-BIDl1ull.js.map → records-map-DU29d6QK.js.map} +1 -1
  101. package/dist/shell-source-maps/assets/{shared-protobase-ui-F5elmh4N.js.map → shared-protobase-ui-Cab5nqST.js.map} +1 -1
  102. package/dist/shell-source-maps/assets/vendor-iwLB0x-s.js.map +1 -0
  103. package/dist/status/status-dialog.js +1 -1
  104. package/package.json +4 -4
  105. package/dist/inline-child-table/number-cell.js +0 -25
  106. package/dist/inline-child-table/totals-footer.js +0 -39
  107. package/dist/mocks/invoices.js +0 -13
  108. package/dist/mocks/products.js +0 -167
  109. package/dist/shell/assets/app-Bm6h0l5D.js +0 -9
  110. package/dist/shell/assets/index-Be8nCyRW.css +0 -2
  111. package/dist/shell/assets/shared-protobase-ui-F5elmh4N.js +0 -2
  112. package/dist/shell-source-maps/assets/app-Bm6h0l5D.js.map +0 -1
  113. package/dist/shell-source-maps/assets/vendor-xNCj9Gc_.js.map +0 -1
@@ -1,16 +1,12 @@
1
1
  import { cn } from "../lib/cn.js";
2
- import { lineTotalCents } from "../mocks/invoices.js";
3
2
  import { lineGrid } from "./columns.js";
4
- import { formatMoney } from "../format/money.js";
5
3
  import { LineMenu } from "./line-menu.js";
6
- import { NumberCell } from "./number-cell.js";
7
4
  import { text } from "./messages.js";
8
5
  import { GripVertical } from "lucide-react";
9
6
  import { jsx, jsxs } from "react/jsx-runtime";
10
7
  import { useSortable } from "@dnd-kit/sortable";
11
8
  //#region src/inline-child-table/line-row.tsx
12
- const parseEuros = (typed) => Math.round(Number(typed.replace(",", ".").replace(/[^0-9.]/g, "")) * 100);
13
- const LineRow = ({ line, position, count, reorderable, editable, onChange, onRemove, onMove }) => {
9
+ const LineRow = ({ line, name, columns, position, count, reorderable, onRemove, onMove, error }) => {
14
10
  const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
15
11
  id: line.id,
16
12
  disabled: !reorderable
@@ -23,7 +19,7 @@ const LineRow = ({ line, position, count, reorderable, editable, onChange, onRem
23
19
  label: text("moveDown"),
24
20
  disabled: position === count - 1,
25
21
  onSelect: () => onMove(position + 1)
26
- }] : [], ...editable ? [{
22
+ }] : [], ...onRemove ? [{
27
23
  label: text("removeLine"),
28
24
  destructive: true,
29
25
  onSelect: onRemove
@@ -31,60 +27,36 @@ const LineRow = ({ line, position, count, reorderable, editable, onChange, onRem
31
27
  return /* @__PURE__ */ jsxs("div", {
32
28
  ref: setNodeRef,
33
29
  "data-line-id": line.id,
30
+ "aria-invalid": error ? true : void 0,
34
31
  style: {
35
32
  transform: transform ? `translate3d(0, ${transform.y}px, 0)` : void 0,
36
33
  transition
37
34
  },
38
- className: cn("group relative border-b border-border bg-background px-2 py-1 last:border-b-0 hover:bg-surface", lineGrid, isDragging && "z-10 bg-surface opacity-80 shadow-pop"),
35
+ className: cn("group relative border-b border-border bg-background px-2 py-1 last:border-b-0 hover:bg-surface", lineGrid, isDragging && "z-10 bg-surface opacity-80 shadow-pop", error && "bg-danger-soft"),
39
36
  children: [
40
37
  reorderable ? /* @__PURE__ */ jsx("button", {
41
38
  ref: setActivatorNodeRef,
42
39
  type: "button",
43
- "aria-label": text("dragToReorder", line.description),
40
+ "aria-label": text("dragToReorder", name),
44
41
  ...attributes,
45
42
  ...listeners,
46
43
  style: { touchAction: "none" },
47
44
  className: "flex size-7 cursor-grab items-center justify-center rounded text-faint-foreground opacity-60 hover:bg-muted hover:opacity-100 focus-visible:opacity-100 active:cursor-grabbing pointer-coarse:size-11",
48
45
  children: /* @__PURE__ */ jsx(GripVertical, { className: "size-4" })
49
46
  }) : /* @__PURE__ */ jsx("span", {}),
50
- /* @__PURE__ */ jsxs("div", {
51
- className: "min-w-0",
52
- children: [/* @__PURE__ */ jsx("p", {
53
- className: "truncate text-foreground",
54
- children: line.description
55
- }), /* @__PURE__ */ jsx("p", {
56
- className: "font-mono text-[11px] text-faint-foreground",
57
- children: line.productId
58
- })]
59
- }),
60
- editable ? /* @__PURE__ */ jsx(NumberCell, {
61
- label: text("quantity"),
62
- value: line.quantity,
63
- format: String,
64
- parse: (typed) => Math.round(Number(typed)),
65
- onCommit: (quantity) => onChange({ quantity })
66
- }) : /* @__PURE__ */ jsx("span", {
67
- className: "px-2 text-right tabular-nums",
68
- children: line.quantity
69
- }),
70
- editable ? /* @__PURE__ */ jsx(NumberCell, {
71
- label: text("unitPrice"),
72
- value: line.unitPriceCents,
73
- format: (cents) => (cents / 100).toFixed(2),
74
- parse: parseEuros,
75
- onCommit: (unitPriceCents) => onChange({ unitPriceCents })
76
- }) : /* @__PURE__ */ jsx("span", {
77
- className: "px-2 text-right tabular-nums",
78
- children: (line.unitPriceCents / 100).toFixed(2)
79
- }),
80
- /* @__PURE__ */ jsx("span", {
81
- className: "px-2 text-right font-medium tabular-nums text-foreground",
82
- children: formatMoney(lineTotalCents(line))
83
- }),
47
+ columns.map((column) => /* @__PURE__ */ jsx("div", {
48
+ className: cn("min-w-0", column.align === "right" && "text-right"),
49
+ children: column.cell(line)
50
+ }, column.key)),
84
51
  menu.length > 0 ? /* @__PURE__ */ jsx(LineMenu, {
85
- label: text("actionsFor", line.description),
52
+ label: text("actionsFor", name),
86
53
  items: menu
87
- }) : /* @__PURE__ */ jsx("span", {})
54
+ }) : /* @__PURE__ */ jsx("span", {}),
55
+ error && /* @__PURE__ */ jsx("p", {
56
+ role: "alert",
57
+ className: "col-span-full px-2 pb-1 text-xs text-danger-text",
58
+ children: error
59
+ })
88
60
  ]
89
61
  });
90
62
  };
@@ -9,20 +9,13 @@ const text = defineMessages({
9
9
  dropped: (name, place, count) => `${name} was dropped at line ${place} of ${count}.`,
10
10
  droppedAtStart: (name) => `${name} was dropped where it started.`,
11
11
  cancelled: (name, place) => `Moving ${name} was cancelled. It is back at line ${place}.`,
12
- item: "Item",
13
- qty: "Qty",
14
- quantity: "Quantity",
15
- unitPrice: "Unit price",
16
- lineTotal: "Line total",
17
12
  addLine: "Add line",
13
+ noLines: "No lines yet.",
18
14
  moveUp: "Move up",
19
15
  moveDown: "Move down",
20
16
  removeLine: "Remove line",
21
17
  dragToReorder: (name) => `Drag to reorder ${name}`,
22
- actionsFor: (name) => `Actions for ${name}`,
23
- subtotal: "Subtotal",
24
- vat: (percent) => `VAT ${percent}%`,
25
- total: "Total"
18
+ actionsFor: (name) => `Actions for ${name}`
26
19
  },
27
20
  nl: {
28
21
  instructions: "Druk op spatie of enter op de sleepgreep om een regel op te pakken. Verplaats hem met de pijltjestoetsen omhoog en omlaag, zet hem neer met spatie of enter, en annuleer met escape. Het regelmenu heeft ook Omhoog en Omlaag.",
@@ -32,20 +25,13 @@ const text = defineMessages({
32
25
  dropped: (name, place, count) => `${name} is neergezet op regel ${place} van ${count}.`,
33
26
  droppedAtStart: (name) => `${name} is neergezet waar hij begon.`,
34
27
  cancelled: (name, place) => `Verplaatsen van ${name} is geannuleerd. Hij staat weer op regel ${place}.`,
35
- item: "Artikel",
36
- qty: "Aantal",
37
- quantity: "Aantal",
38
- unitPrice: "Stukprijs",
39
- lineTotal: "Regeltotaal",
40
28
  addLine: "Regel toevoegen",
29
+ noLines: "Nog geen regels.",
41
30
  moveUp: "Omhoog",
42
31
  moveDown: "Omlaag",
43
32
  removeLine: "Regel verwijderen",
44
33
  dragToReorder: (name) => `Sleep om ${name} te verplaatsen`,
45
- actionsFor: (name) => `Acties voor ${name}`,
46
- subtotal: "Subtotaal",
47
- vat: (percent) => `Btw ${percent}%`,
48
- total: "Totaal"
34
+ actionsFor: (name) => `Acties voor ${name}`
49
35
  }
50
36
  });
51
37
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { cn } from "../../lib/cn.js";
2
- import { formatRelativeTime } from "../../format/date.js";
3
2
  import { toneDots } from "../../primitives/badge.js";
3
+ import { formatRelativeTime } from "../../format/date.js";
4
4
  import { RouteLink } from "../../primitives/route-link.js";
5
5
  import { text } from "./messages.js";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -2,8 +2,8 @@ import { useAuth } from "../auth/auth-provider.js";
2
2
  import { cn } from "../lib/cn.js";
3
3
  import { Spinner } from "../primitives/spinner.js";
4
4
  import { Button, buttonClass } from "../primitives/button.js";
5
- import { Input } from "../primitives/input.js";
6
5
  import { RouteLink } from "../primitives/route-link.js";
6
+ import { Input } from "../primitives/input.js";
7
7
  import { authMessage } from "../auth/auth-messages.js";
8
8
  import { useAction } from "./use-action.js";
9
9
  import { text } from "./messages.js";
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.63.3";
2
+ var version = "0.63.5";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };
@@ -9,7 +9,12 @@ export type DialogProps = {
9
9
  children?: ReactNode;
10
10
  /** Room for a row of cards or a table in the body, instead of a short question. */
11
11
  wide?: boolean;
12
+ /** Names the dialog in its layer's `data-dialog` (empty without), for code that asks whether an element sits in it. */
13
+ name?: string;
12
14
  };
13
- /** A modal with a title, optional body and action buttons. Closes on Escape and on a click outside. */
14
- export declare const Dialog: ({ title, description, onClose, actions, children, wide }: DialogProps) => import("react").JSX.Element;
15
+ /**
16
+ * A modal with a title, optional body and action buttons. Closes on Escape and on a click outside. It is portalled to
17
+ * the body, so no stacking context of the page it opens from, such as a sticky column, puts page content above it.
18
+ */
19
+ export declare const Dialog: ({ title, description, onClose, actions, children, wide, name }: DialogProps) => import("react").ReactPortal;
15
20
  //#endregion
@@ -2,12 +2,17 @@ import { cn } from "../lib/cn.js";
2
2
  import { useFocusTrap } from "../lib/use-focus-trap.js";
3
3
  import { useRef } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { createPortal } from "react-dom";
5
6
  //#region src/primitives/dialog.tsx
6
- /** A modal with a title, optional body and action buttons. Closes on Escape and on a click outside. */
7
- const Dialog = ({ title, description, onClose, actions, children, wide = false }) => {
7
+ /**
8
+ * A modal with a title, optional body and action buttons. Closes on Escape and on a click outside. It is portalled to
9
+ * the body, so no stacking context of the page it opens from, such as a sticky column, puts page content above it.
10
+ */
11
+ const Dialog = ({ title, description, onClose, actions, children, wide = false, name }) => {
8
12
  const panel = useRef(null);
9
13
  useFocusTrap(panel, true, onClose);
10
- return /* @__PURE__ */ jsx("div", {
14
+ return createPortal(/* @__PURE__ */ jsx("div", {
15
+ "data-dialog": name ?? "",
11
16
  className: "fixed inset-0 z-[90] flex items-center justify-center bg-backdrop/30 p-4 pb-[calc(1rem+var(--pb-safe-bottom))] pl-[calc(1rem+var(--pb-safe-left))] pr-[calc(1rem+var(--pb-safe-right))] pt-[calc(1rem+var(--pb-safe-top))]",
12
17
  onMouseDown: (event) => event.target === event.currentTarget && onClose(),
13
18
  children: /* @__PURE__ */ jsxs("div", {
@@ -36,7 +41,7 @@ const Dialog = ({ title, description, onClose, actions, children, wide = false }
36
41
  })
37
42
  ]
38
43
  })
39
- });
44
+ }), document.body);
40
45
  };
41
46
  //#endregion
42
47
  export { Dialog };
@@ -1,7 +1,7 @@
1
1
  import { Button } from "../primitives/button.js";
2
+ import { Avatar } from "../primitives/avatar.js";
2
3
  import { text } from "./messages.js";
3
4
  import { FieldControlContext } from "../primitives/field-control.js";
4
- import { Avatar } from "../primitives/avatar.js";
5
5
  import { useId } from "react";
6
6
  import { TriangleAlert } from "lucide-react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -14,8 +14,6 @@ const text = defineMessages({
14
14
  lastEditedBy: "Last edited by",
15
15
  lastUpdated: (ago) => `Last updated ${ago}`,
16
16
  viewing: (count) => `${count} viewing`,
17
- savingSubject: (subject) => `Saving ${subject}...`,
18
- subjectSaved: (subject) => `${subject} saved`,
19
17
  tabs: "Tabs"
20
18
  },
21
19
  nl: {
@@ -31,8 +29,6 @@ const text = defineMessages({
31
29
  lastEditedBy: "Laatst bewerkt door",
32
30
  lastUpdated: (ago) => `Laatst bijgewerkt ${ago}`,
33
31
  viewing: (count) => `${count} kijken mee`,
34
- savingSubject: (subject) => `${subject} bewaren...`,
35
- subjectSaved: (subject) => `${subject} bewaard`,
36
32
  tabs: "Tabbladen"
37
33
  }
38
34
  });
@@ -1,6 +1,6 @@
1
- import { text } from "./messages.js";
2
- import { AvatarStack } from "../primitives/avatar.js";
3
1
  import { Badge } from "../primitives/badge.js";
2
+ import { AvatarStack } from "../primitives/avatar.js";
3
+ import { text } from "./messages.js";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/record-view/record-header.tsx
6
6
  const RecordHeader = ({ collection, title, status, lastEditedBy, presence = [], actions }) => {