@protobase/ui 0.63.2 → 0.63.4

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 (46) hide show
  1. package/dist/activity-chart/activity-chart.js +1 -1
  2. package/dist/app/lines-plan.js +116 -0
  3. package/dist/app/list-order.js +7 -1
  4. package/dist/app/record-lines-cell.js +47 -0
  5. package/dist/app/record-lines.js +102 -25
  6. package/dist/app/record-messages.js +8 -2
  7. package/dist/app/record-page.js +13 -15
  8. package/dist/app/use-lines-draft.js +94 -35
  9. package/dist/app/use-lines.js +21 -7
  10. package/dist/app/use-record-editor.js +15 -10
  11. package/dist/app/use-record-lines.js +47 -0
  12. package/dist/auth/auth-gate.js +4 -1
  13. package/dist/auth/auth-provider.js +4 -1
  14. package/dist/auth/first-run-page.js +49 -40
  15. package/dist/auth/messages.js +4 -0
  16. package/dist/data/use-list.d.ts +27 -1
  17. package/dist/data/use-list.js +10 -3
  18. package/dist/data-grid/cell-text.js +1 -1
  19. package/dist/data-grid/cells.js +1 -1
  20. package/dist/inline-child-table/columns.js +7 -2
  21. package/dist/inline-child-table/inline-child-table.js +29 -48
  22. package/dist/inline-child-table/line-row.js +16 -44
  23. package/dist/inline-child-table/messages.js +2 -0
  24. package/dist/package.js +1 -1
  25. package/dist/shell/assets/app-CBYlZ19-.js +9 -0
  26. package/dist/shell/assets/{calls-BjMBacTA.js → calls-BIXaKTs0.js} +2 -2
  27. package/dist/shell/assets/{index-DYpysp6_.js → index-BshKxX1Z.js} +2 -2
  28. package/dist/shell/assets/index-BvT0X9o1.css +2 -0
  29. package/dist/shell/assets/{records-map-BZPeBvM4.js → records-map-D1SJKyvj.js} +2 -2
  30. package/dist/shell/assets/{shared-protobase-ui-ByA8um6R.js → shared-protobase-ui-DibYt-TM.js} +2 -2
  31. package/dist/shell/index.html +4 -4
  32. package/dist/shell/protobase.shell.json +2 -2
  33. package/dist/shell/protobase.sw.js +2 -2
  34. package/dist/shell-source-maps/assets/app-CBYlZ19-.js.map +1 -0
  35. package/dist/shell-source-maps/assets/{calls-BjMBacTA.js.map → calls-BIXaKTs0.js.map} +1 -1
  36. package/dist/shell-source-maps/assets/{index-DYpysp6_.js.map → index-BshKxX1Z.js.map} +1 -1
  37. package/dist/shell-source-maps/assets/{records-map-BZPeBvM4.js.map → records-map-D1SJKyvj.js.map} +1 -1
  38. package/dist/shell-source-maps/assets/{shared-protobase-ui-ByA8um6R.js.map → shared-protobase-ui-DibYt-TM.js.map} +1 -1
  39. package/package.json +4 -4
  40. package/dist/inline-child-table/number-cell.js +0 -25
  41. package/dist/inline-child-table/totals-footer.js +0 -39
  42. package/dist/mocks/invoices.js +0 -13
  43. package/dist/mocks/products.js +0 -167
  44. package/dist/shell/assets/app-DqOuQJpX.js +0 -9
  45. package/dist/shell/assets/index-Be8nCyRW.css +0 -2
  46. package/dist/shell-source-maps/assets/app-DqOuQJpX.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
  };
@@ -15,6 +15,7 @@ const text = defineMessages({
15
15
  unitPrice: "Unit price",
16
16
  lineTotal: "Line total",
17
17
  addLine: "Add line",
18
+ noLines: "No lines yet.",
18
19
  moveUp: "Move up",
19
20
  moveDown: "Move down",
20
21
  removeLine: "Remove line",
@@ -38,6 +39,7 @@ const text = defineMessages({
38
39
  unitPrice: "Stukprijs",
39
40
  lineTotal: "Regeltotaal",
40
41
  addLine: "Regel toevoegen",
42
+ noLines: "Nog geen regels.",
41
43
  moveUp: "Omhoog",
42
44
  moveDown: "Omlaag",
43
45
  removeLine: "Regel verwijderen",
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.63.2";
2
+ var version = "0.63.4";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };