@burdenoff/microfe-movethewheels 2026.929.4 → 2026.930.2

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 (49) hide show
  1. package/dist/components/CustomerPicker.js +52 -48
  2. package/dist/components/EntityCombobox.js +25 -23
  3. package/dist/components/OrderItemRow.js +123 -78
  4. package/dist/hooks/useCustomers.js +52 -17
  5. package/dist/hooks/useFleet.js +126 -44
  6. package/dist/hooks/useInventory.js +43 -7
  7. package/dist/hooks/useMultiModalShipments.js +30 -26
  8. package/dist/hooks/useRefetchOnLeaveEdit.js +10 -0
  9. package/dist/hooks/useRoutes.js +55 -15
  10. package/dist/movethewheels/components/CustomerPicker.d.ts +5 -1
  11. package/dist/movethewheels/components/EntityCombobox.d.ts +6 -3
  12. package/dist/movethewheels/components/OrderItemRow.d.ts +7 -1
  13. package/dist/movethewheels/hooks/useCustomers.d.ts +3 -0
  14. package/dist/movethewheels/hooks/useFleet.d.ts +6 -0
  15. package/dist/movethewheels/hooks/useInventory.d.ts +2 -0
  16. package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +1 -0
  17. package/dist/movethewheels/hooks/useRefetchOnLeaveEdit.d.ts +7 -0
  18. package/dist/movethewheels/hooks/useRoutes.d.ts +3 -0
  19. package/dist/movethewheels/utils/orderValidation.d.ts +11 -0
  20. package/dist/pages/CreateOrderPage.js +349 -297
  21. package/dist/pages/DriverDetailsPage.js +258 -251
  22. package/dist/pages/DriversPage.js +3 -1
  23. package/dist/pages/MultiModalShipmentPage.js +139 -125
  24. package/dist/pages/OrderDetailsPage.js +132 -140
  25. package/dist/pages/ProductDetailsPage.js +22 -19
  26. package/dist/pages/RouteDetailsPage.js +284 -281
  27. package/dist/pages/TrackingPage.js +2 -1
  28. package/dist/pages/VehicleDetailsPage.js +28 -25
  29. package/dist/utils/orderValidation.js +18 -0
  30. package/package.json +1 -1
  31. package/src/movethewheels/components/CustomerPicker.tsx +12 -0
  32. package/src/movethewheels/components/EntityCombobox.tsx +30 -11
  33. package/src/movethewheels/components/OrderItemRow.tsx +44 -0
  34. package/src/movethewheels/hooks/useCustomers.ts +38 -0
  35. package/src/movethewheels/hooks/useFleet.ts +125 -5
  36. package/src/movethewheels/hooks/useInventory.ts +42 -0
  37. package/src/movethewheels/hooks/useMultiModalShipments.ts +9 -7
  38. package/src/movethewheels/hooks/useRefetchOnLeaveEdit.ts +18 -0
  39. package/src/movethewheels/hooks/useRoutes.ts +51 -0
  40. package/src/movethewheels/pages/CreateOrderPage.tsx +66 -2
  41. package/src/movethewheels/pages/DriverDetailsPage.tsx +14 -1
  42. package/src/movethewheels/pages/DriversPage.tsx +7 -1
  43. package/src/movethewheels/pages/MultiModalShipmentPage.tsx +15 -1
  44. package/src/movethewheels/pages/OrderDetailsPage.tsx +25 -25
  45. package/src/movethewheels/pages/ProductDetailsPage.tsx +2 -0
  46. package/src/movethewheels/pages/RouteDetailsPage.tsx +10 -4
  47. package/src/movethewheels/pages/TrackingPage.tsx +7 -2
  48. package/src/movethewheels/pages/VehicleDetailsPage.tsx +2 -0
  49. package/src/movethewheels/utils/orderValidation.ts +53 -0
@@ -14,11 +14,11 @@ var C = {
14
14
  phone: "",
15
15
  company: ""
16
16
  };
17
- function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCustomer: O, isLoading: k, error: A, onRetry: j, onOpenCustomers: M, selectedCustomer: N, onSearchQueryChange: P, disabled: F = !1 }) {
18
- let [I, L] = y(!1), [R, z] = y(C), [B, V] = y(!1), [H, U] = y(null), W = () => {
19
- U(null), z(C), L(!0);
20
- }, G = () => {
21
- B || L(!1);
17
+ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCustomer: O, isLoading: k, isLoadingMore: A = !1, error: j, onRetry: M, onLoadMore: N, hasMore: P = !1, totalCount: F, onOpenCustomers: I, selectedCustomer: L, onSearchQueryChange: R, disabled: z = !1 }) {
18
+ let [B, V] = y(!1), [H, U] = y(C), [W, G] = y(!1), [K, q] = y(null), J = () => {
19
+ q(null), U(C), V(!0);
20
+ }, Y = () => {
21
+ W || V(!1);
22
22
  };
23
23
  return /* @__PURE__ */ S("div", {
24
24
  className: "space-y-2",
@@ -32,8 +32,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
32
32
  type: "button",
33
33
  variant: "ghost",
34
34
  size: "sm",
35
- onClick: W,
36
- disabled: F || k,
35
+ onClick: J,
36
+ disabled: z || k,
37
37
  children: [/* @__PURE__ */ x(e, {
38
38
  size: 14,
39
39
  className: "mr-1"
@@ -55,37 +55,41 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
55
55
  " ",
56
56
  e.email ? `(${e.email})` : ""
57
57
  ] }),
58
- selectedOption: N,
58
+ selectedOption: L,
59
59
  required: !0,
60
60
  placeholder: k ? "Loading customers..." : "Select customer",
61
61
  searchPlaceholder: "Search customers",
62
62
  emptyText: "No customers found.",
63
- disabled: F || !!A,
64
- error: A ? "Customers could not be loaded" : void 0,
65
- onSearchChange: P,
63
+ disabled: z || !!j,
64
+ error: j ? "Customers could not be loaded" : void 0,
65
+ onSearchChange: R,
66
+ hasMore: P,
67
+ totalCount: F,
68
+ onLoadMore: N,
69
+ loadingMore: A,
66
70
  className: "flex-1"
67
- }), A && /* @__PURE__ */ S(r, {
71
+ }), j && /* @__PURE__ */ S(r, {
68
72
  type: "button",
69
73
  variant: "outline",
70
74
  size: "sm",
71
- onClick: j,
75
+ onClick: M,
72
76
  children: [/* @__PURE__ */ x(t, {
73
77
  size: 14,
74
78
  className: "mr-1"
75
79
  }), "Retry"]
76
80
  })]
77
81
  }),
78
- A ? /* @__PURE__ */ S("div", {
82
+ j ? /* @__PURE__ */ S("div", {
79
83
  className: "flex flex-wrap items-center gap-2",
80
84
  children: [/* @__PURE__ */ x("p", {
81
85
  role: "alert",
82
86
  className: "text-sm text-status-error-text",
83
87
  children: "Customers could not be loaded. Retry or add a customer to continue."
84
- }), M && /* @__PURE__ */ x(r, {
88
+ }), I && /* @__PURE__ */ x(r, {
85
89
  type: "button",
86
90
  variant: "outline",
87
91
  size: "sm",
88
- onClick: M,
92
+ onClick: I,
89
93
  children: "Open customer page"
90
94
  })]
91
95
  }) : !k && w.length === 0 ? /* @__PURE__ */ S("div", {
@@ -106,8 +110,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
106
110
  type: "button",
107
111
  size: "sm",
108
112
  className: "mt-3",
109
- onClick: W,
110
- disabled: F,
113
+ onClick: J,
114
+ disabled: z,
111
115
  children: [/* @__PURE__ */ x(e, {
112
116
  size: 14,
113
117
  className: "mr-1.5"
@@ -115,34 +119,34 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
115
119
  })]
116
120
  }) : null,
117
121
  /* @__PURE__ */ x(i, {
118
- open: I,
119
- onOpenChange: (e) => e ? L(!0) : G(),
122
+ open: B,
123
+ onOpenChange: (e) => e ? V(!0) : Y(),
120
124
  children: /* @__PURE__ */ S(a, { children: [/* @__PURE__ */ S(c, { children: [/* @__PURE__ */ x(l, { children: "Create customer" }), /* @__PURE__ */ x(o, { children: "Add the customer without leaving this order. They will be selected automatically." })] }), /* @__PURE__ */ S("form", {
121
125
  onSubmit: async (e) => {
122
126
  e.preventDefault(), e.stopPropagation();
123
- let t = R.name.trim();
127
+ let t = H.name.trim();
124
128
  if (!t) {
125
- U("Customer name is required.");
129
+ q("Customer name is required.");
126
130
  return;
127
131
  }
128
- V(!0), U(null);
132
+ G(!0), q(null);
129
133
  try {
130
134
  D(await O({
131
135
  name: t,
132
- type: R.type,
133
- email: R.email.trim() || void 0,
134
- phone: R.phone.trim() || void 0,
135
- company: R.company.trim() || void 0
136
- })), L(!1), z(C);
136
+ type: H.type,
137
+ email: H.email.trim() || void 0,
138
+ phone: H.phone.trim() || void 0,
139
+ company: H.company.trim() || void 0
140
+ })), V(!1), U(C);
137
141
  } catch (e) {
138
- U(e instanceof Error ? e.message : "Could not create the customer. Please try again.");
142
+ q(e instanceof Error ? e.message : "Could not create the customer. Please try again.");
139
143
  } finally {
140
- V(!1);
144
+ G(!1);
141
145
  }
142
146
  },
143
147
  className: "space-y-4",
144
148
  children: [
145
- /* @__PURE__ */ x(_, { message: H }),
149
+ /* @__PURE__ */ x(_, { message: K }),
146
150
  /* @__PURE__ */ S("div", {
147
151
  className: "space-y-2",
148
152
  children: [/* @__PURE__ */ x(d, {
@@ -150,8 +154,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
150
154
  children: "Name"
151
155
  }), /* @__PURE__ */ x(u, {
152
156
  id: "quick-customer-name",
153
- value: R.name,
154
- onChange: (e) => z((t) => ({
157
+ value: H.name,
158
+ onChange: (e) => U((t) => ({
155
159
  ...t,
156
160
  name: e.target.value
157
161
  })),
@@ -166,8 +170,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
166
170
  htmlFor: "quick-customer-type",
167
171
  children: "Customer type"
168
172
  }), /* @__PURE__ */ S(f, {
169
- value: R.type,
170
- onValueChange: (e) => z((t) => ({
173
+ value: H.type,
174
+ onValueChange: (e) => U((t) => ({
171
175
  ...t,
172
176
  type: e
173
177
  })),
@@ -193,8 +197,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
193
197
  }), /* @__PURE__ */ x(u, {
194
198
  id: "quick-customer-email",
195
199
  type: "email",
196
- value: R.email,
197
- onChange: (e) => z((t) => ({
200
+ value: H.email,
201
+ onChange: (e) => U((t) => ({
198
202
  ...t,
199
203
  email: e.target.value
200
204
  })),
@@ -207,8 +211,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
207
211
  children: "Phone"
208
212
  }), /* @__PURE__ */ x(u, {
209
213
  id: "quick-customer-phone",
210
- value: R.phone,
211
- onChange: (e) => z((t) => ({
214
+ value: H.phone,
215
+ onChange: (e) => U((t) => ({
212
216
  ...t,
213
217
  phone: e.target.value
214
218
  })),
@@ -223,8 +227,8 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
223
227
  children: "Company"
224
228
  }), /* @__PURE__ */ x(u, {
225
229
  id: "quick-customer-company",
226
- value: R.company,
227
- onChange: (e) => z((t) => ({
230
+ value: H.company,
231
+ onChange: (e) => U((t) => ({
228
232
  ...t,
229
233
  company: e.target.value
230
234
  })),
@@ -232,26 +236,26 @@ function w({ customers: w, value: T, onValueChange: E, onCreated: D, createCusto
232
236
  })]
233
237
  }),
234
238
  /* @__PURE__ */ S(s, { children: [
235
- M && /* @__PURE__ */ x(r, {
239
+ I && /* @__PURE__ */ x(r, {
236
240
  type: "button",
237
241
  variant: "outline",
238
242
  onClick: () => {
239
- G(), M();
243
+ Y(), I();
240
244
  },
241
- disabled: B,
245
+ disabled: W,
242
246
  children: "Use customer page"
243
247
  }),
244
248
  /* @__PURE__ */ x(r, {
245
249
  type: "button",
246
250
  variant: "outline",
247
- onClick: G,
248
- disabled: B,
251
+ onClick: Y,
252
+ disabled: W,
249
253
  children: "Cancel"
250
254
  }),
251
255
  /* @__PURE__ */ S(r, {
252
256
  type: "submit",
253
- disabled: B,
254
- children: [/* @__PURE__ */ x(e, { size: 16 }), B ? "Creating..." : "Create and select"]
257
+ disabled: W,
258
+ children: [/* @__PURE__ */ x(e, { size: 16 }), W ? "Creating..." : "Create and select"]
255
259
  })
256
260
  ] })
257
261
  ]
@@ -6,16 +6,16 @@ import { useDebouncedValue as d } from "../hooks/useDebouncedValue.js";
6
6
  import { useEffect as f, useState as p } from "react";
7
7
  import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
8
  //#region src/movethewheels/components/EntityCombobox.tsx
9
- function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, renderOption: x, getLabel: S, selectedOption: C = null, selectedLoading: w = !1, required: T = !1, placeholder: E = "Select…", searchPlaceholder: D = "Search…", emptyText: O = "No results found.", noneLabel: k = "None", disabled: A = !1, id: j, error: M, className: N, onSearchChange: P, hasMore: F = !1, totalCount: I }) {
10
- let [L, R] = p(!1), [z, B] = p(""), V = d(z.trim(), 200);
9
+ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, renderOption: x, getLabel: S, selectedOption: C = null, selectedLoading: w = !1, required: T = !1, placeholder: E = "Select…", searchPlaceholder: D = "Search…", emptyText: O = "No results found.", noneLabel: k = "None", disabled: A = !1, id: j, error: M, className: N, onSearchChange: P, hasMore: F = !1, totalCount: I, onLoadMore: L, loadingMore: R = !1 }) {
10
+ let [z, B] = p(!1), [V, H] = p(""), U = d(V.trim(), 200);
11
11
  f(() => {
12
- P && P(V);
13
- }, [V]);
14
- let H = C ? S(C) : g ? w ? "Loading…" : g : E, U = n("w-full flex items-center justify-between gap-2 px-3 py-2", "bg-surface", "border border-default", "rounded-lg", "text-left text-sm text-text-primary", "focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]", "disabled:bg-bg-sunken disabled:cursor-not-allowed", "transition-all duration-200", M && "border-[var(--color-status-error)]", !C && "text-text-tertiary", N), W = F && typeof I == "number" && I > v.length;
12
+ P && P(U);
13
+ }, [U]);
14
+ let W = C ? S(C) : g ? w ? "Loading…" : g : E, G = n("w-full flex items-center justify-between gap-2 px-3 py-2", "bg-surface", "border border-default", "rounded-lg", "text-left text-sm text-text-primary", "focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)]", "disabled:bg-bg-sunken disabled:cursor-not-allowed", "transition-all duration-200", M && "border-[var(--color-status-error)]", !C && "text-text-tertiary", N), K = !!(L && F);
15
15
  return /* @__PURE__ */ h(c, {
16
- open: L,
16
+ open: z,
17
17
  onOpenChange: (e) => {
18
- R(e), e || B("");
18
+ B(e), e || H("");
19
19
  },
20
20
  children: [/* @__PURE__ */ m(u, {
21
21
  asChild: !0,
@@ -23,14 +23,14 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
23
23
  type: "button",
24
24
  id: j,
25
25
  role: "combobox",
26
- "aria-expanded": L,
26
+ "aria-expanded": z,
27
27
  "aria-required": T,
28
28
  "aria-invalid": M ? !0 : void 0,
29
29
  disabled: A,
30
- className: U,
30
+ className: G,
31
31
  children: [/* @__PURE__ */ m("span", {
32
32
  className: "truncate",
33
- children: H
33
+ children: W
34
34
  }), /* @__PURE__ */ m(t, {
35
35
  size: 16,
36
36
  className: "shrink-0 text-text-tertiary",
@@ -44,8 +44,8 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
44
44
  shouldFilter: !1,
45
45
  className: "bg-surface text-text-primary",
46
46
  children: [P && /* @__PURE__ */ m(a, {
47
- value: z,
48
- onValueChange: B,
47
+ value: V,
48
+ onValueChange: H,
49
49
  placeholder: D,
50
50
  className: "text-text-primary placeholder:text-text-tertiary"
51
51
  }), /* @__PURE__ */ h(s, { children: [
@@ -56,7 +56,7 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
56
56
  !T && /* @__PURE__ */ h(o, {
57
57
  value: "__none__",
58
58
  onSelect: () => {
59
- _(""), R(!1);
59
+ _(""), B(!1);
60
60
  },
61
61
  className: "text-text-tertiary",
62
62
  children: [/* @__PURE__ */ m(e, {
@@ -73,7 +73,7 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
73
73
  return /* @__PURE__ */ h(o, {
74
74
  value: r,
75
75
  onSelect: () => {
76
- _(r), R(!1);
76
+ _(r), B(!1);
77
77
  },
78
78
  className: "text-text-primary",
79
79
  children: [/* @__PURE__ */ m(e, {
@@ -86,15 +86,17 @@ function g({ value: g, onChange: _, options: v, loading: y = !1, getId: b, rende
86
86
  })]
87
87
  }, r);
88
88
  }),
89
- W && /* @__PURE__ */ h("div", {
90
- className: "px-2 py-1.5 text-xs text-text-tertiary border-t border-border-seam",
91
- children: [
92
- "Showing ",
93
- v.length,
94
- " of ",
95
- I,
96
- P ? " — keep typing to narrow results." : "."
97
- ]
89
+ K && /* @__PURE__ */ m("div", {
90
+ className: "border-t border-border-seam p-2",
91
+ children: /* @__PURE__ */ m("button", {
92
+ type: "button",
93
+ className: "w-full rounded-md px-3 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/10 focus:outline-none focus:ring-2 focus:ring-[var(--color-border-focus)] disabled:cursor-not-allowed disabled:opacity-60",
94
+ onClick: () => void L?.(),
95
+ disabled: y || R,
96
+ "aria-busy": R,
97
+ "aria-label": R ? "Loading more options" : `Load more options${typeof I == "number" ? ` (${v.length} of ${I} shown)` : ""}`,
98
+ children: R ? "Loading more…" : `Load more${typeof I == "number" ? ` (${v.length} of ${I})` : ""}`
99
+ })
98
100
  })
99
101
  ] })]
100
102
  })
@@ -7,25 +7,30 @@ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  function u(e, t) {
8
8
  return e <= 0 ? "No stock recorded for this item." : t.length === 1 ? `${e.toLocaleString()} available at ${t[0].warehouseName}` : `${e.toLocaleString()} available across ${t.length} warehouses`;
9
9
  }
10
- function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, onRemove: g }) {
11
- let { product: _, isLoading: v } = t(d.productId || void 0), { levels: y, totalAvailable: b, isLoading: x } = n(d.productId || void 0), S = d.dimensions ?? {
10
+ function d({ item: d, index: f, products: p, productsLoading: m, productsLoadingMore: h = !1, productsHasMore: g = !1, productsTotalCount: _, onLoadMoreProducts: v, errors: y = {}, onUpdate: b, onRemove: x }) {
11
+ let { product: S, isLoading: C } = t(d.productId || void 0), { levels: w, totalAvailable: T, isLoading: E } = n(d.productId || void 0), D = d.dimensions ?? {
12
12
  length: 0,
13
13
  width: 0,
14
14
  height: 0,
15
15
  unit: "cm"
16
- }, C = (e) => {
16
+ }, O = (e) => {
17
17
  if (!e) {
18
- h(f, "productId", "");
18
+ b(f, "productId", "");
19
19
  return;
20
20
  }
21
21
  let t = p.find((t) => t.id === e);
22
- t && (h(f, "productId", t.id), h(f, "name", t.name), h(f, "sku", t.sku), h(f, "weight", t.weight), h(f, "value", t.value), h(f, "dimensions", t.dimensions));
23
- }, w = (e, t) => {
24
- h(f, "dimensions", {
25
- ...S,
22
+ t && (b(f, "productId", t.id), b(f, "name", t.name), b(f, "sku", t.sku), b(f, "weight", t.weight), b(f, "value", t.value), b(f, "dimensions", t.dimensions));
23
+ }, k = (e, t) => {
24
+ b(f, "dimensions", {
25
+ ...D,
26
26
  [e]: Number.parseFloat(t) || 0
27
27
  });
28
- };
28
+ }, A = (e) => y[e] ? /* @__PURE__ */ c("p", {
29
+ id: `item-${e}-${d.id}-error`,
30
+ className: "text-xs text-status-error-text",
31
+ role: "alert",
32
+ children: y[e]
33
+ }) : null;
29
34
  return /* @__PURE__ */ l("div", {
30
35
  className: "rounded-card border border-border-subtle bg-bg-surface p-4 shadow-elevation-1 sm:p-5",
31
36
  "aria-labelledby": `order-item-${d.id}-title`,
@@ -43,7 +48,7 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
43
48
  variant: "ghost",
44
49
  size: "icon",
45
50
  className: "shrink-0 text-status-error-text",
46
- onClick: () => g(f),
51
+ onClick: () => x(f),
47
52
  "aria-label": `Remove item ${f + 1}`,
48
53
  title: `Remove item ${f + 1}`,
49
54
  children: /* @__PURE__ */ c(e, {
@@ -64,7 +69,7 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
64
69
  /* @__PURE__ */ c(o, {
65
70
  id: `item-product-${d.id}`,
66
71
  value: d.productId,
67
- onChange: C,
72
+ onChange: O,
68
73
  options: p,
69
74
  loading: m,
70
75
  getId: (e) => e.id,
@@ -81,16 +86,20 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
81
86
  ]
82
87
  })
83
88
  ] }),
84
- selectedOption: _,
85
- selectedLoading: v,
89
+ selectedOption: S,
90
+ selectedLoading: C,
86
91
  placeholder: "Pick from your product catalog",
87
92
  emptyText: "No products found.",
88
- noneLabel: "Enter details manually"
93
+ noneLabel: "Enter details manually",
94
+ hasMore: g,
95
+ totalCount: _,
96
+ onLoadMore: v,
97
+ loadingMore: h
89
98
  }),
90
- d.productId && !x && /* @__PURE__ */ c("p", {
99
+ d.productId && !E && /* @__PURE__ */ c("p", {
91
100
  className: "mt-2 text-xs text-text-secondary",
92
101
  role: "status",
93
- children: u(b, y)
102
+ children: u(T, w)
94
103
  })
95
104
  ]
96
105
  }),
@@ -99,68 +108,98 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
99
108
  children: [
100
109
  /* @__PURE__ */ l("div", {
101
110
  className: "space-y-2 lg:col-span-4",
102
- children: [/* @__PURE__ */ c(a, {
103
- htmlFor: `item-name-${d.id}`,
104
- children: "Item name"
105
- }), /* @__PURE__ */ c(i, {
106
- id: `item-name-${d.id}`,
107
- value: d.name,
108
- onChange: (e) => h(f, "name", e.target.value),
109
- placeholder: "Product name"
110
- })]
111
+ children: [
112
+ /* @__PURE__ */ c(a, {
113
+ htmlFor: `item-name-${d.id}`,
114
+ children: "Item name"
115
+ }),
116
+ /* @__PURE__ */ c(i, {
117
+ id: `item-name-${d.id}`,
118
+ value: d.name,
119
+ onChange: (e) => b(f, "name", e.target.value),
120
+ placeholder: "Product name",
121
+ "aria-invalid": !!y.name,
122
+ "aria-describedby": y.name ? `item-name-${d.id}-error` : void 0
123
+ }),
124
+ A("name")
125
+ ]
111
126
  }),
112
127
  /* @__PURE__ */ l("div", {
113
128
  className: "space-y-2 lg:col-span-3",
114
- children: [/* @__PURE__ */ c(a, {
115
- htmlFor: `item-sku-${d.id}`,
116
- children: "SKU"
117
- }), /* @__PURE__ */ c(i, {
118
- id: `item-sku-${d.id}`,
119
- value: d.sku,
120
- onChange: (e) => h(f, "sku", e.target.value),
121
- placeholder: "SKU-001"
122
- })]
129
+ children: [
130
+ /* @__PURE__ */ c(a, {
131
+ htmlFor: `item-sku-${d.id}`,
132
+ children: "SKU"
133
+ }),
134
+ /* @__PURE__ */ c(i, {
135
+ id: `item-sku-${d.id}`,
136
+ value: d.sku,
137
+ onChange: (e) => b(f, "sku", e.target.value),
138
+ placeholder: "SKU-001",
139
+ "aria-invalid": !!y.sku,
140
+ "aria-describedby": y.sku ? `item-sku-${d.id}-error` : void 0
141
+ }),
142
+ A("sku")
143
+ ]
123
144
  }),
124
145
  /* @__PURE__ */ l("div", {
125
146
  className: "space-y-2 lg:col-span-2",
126
- children: [/* @__PURE__ */ c(a, {
127
- htmlFor: `item-quantity-${d.id}`,
128
- children: "Quantity"
129
- }), /* @__PURE__ */ c(i, {
130
- id: `item-quantity-${d.id}`,
131
- type: "number",
132
- min: "1",
133
- value: d.quantity,
134
- onChange: (e) => h(f, "quantity", parseInt(e.target.value, 10) || 1)
135
- })]
147
+ children: [
148
+ /* @__PURE__ */ c(a, {
149
+ htmlFor: `item-quantity-${d.id}`,
150
+ children: "Quantity"
151
+ }),
152
+ /* @__PURE__ */ c(i, {
153
+ id: `item-quantity-${d.id}`,
154
+ type: "number",
155
+ min: "1",
156
+ value: d.quantity,
157
+ onChange: (e) => b(f, "quantity", parseInt(e.target.value, 10) || 1),
158
+ "aria-invalid": !!y.quantity,
159
+ "aria-describedby": y.quantity ? `item-quantity-${d.id}-error` : void 0
160
+ }),
161
+ A("quantity")
162
+ ]
136
163
  }),
137
164
  /* @__PURE__ */ l("div", {
138
165
  className: "space-y-2 lg:col-span-2",
139
- children: [/* @__PURE__ */ c(a, {
140
- htmlFor: `item-weight-${d.id}`,
141
- children: "Weight (kg)"
142
- }), /* @__PURE__ */ c(i, {
143
- id: `item-weight-${d.id}`,
144
- type: "number",
145
- min: "0",
146
- step: "0.1",
147
- value: d.weight,
148
- onChange: (e) => h(f, "weight", parseFloat(e.target.value) || 0)
149
- })]
166
+ children: [
167
+ /* @__PURE__ */ c(a, {
168
+ htmlFor: `item-weight-${d.id}`,
169
+ children: "Weight (kg)"
170
+ }),
171
+ /* @__PURE__ */ c(i, {
172
+ id: `item-weight-${d.id}`,
173
+ type: "number",
174
+ min: "0",
175
+ step: "0.1",
176
+ value: d.weight,
177
+ onChange: (e) => b(f, "weight", parseFloat(e.target.value) || 0),
178
+ "aria-invalid": !!y.weight,
179
+ "aria-describedby": y.weight ? `item-weight-${d.id}-error` : void 0
180
+ }),
181
+ A("weight")
182
+ ]
150
183
  }),
151
184
  /* @__PURE__ */ l("div", {
152
185
  className: "space-y-2 lg:col-span-1",
153
- children: [/* @__PURE__ */ c(a, {
154
- htmlFor: `item-value-${d.id}`,
155
- children: "Value ($)"
156
- }), /* @__PURE__ */ c(i, {
157
- id: `item-value-${d.id}`,
158
- type: "number",
159
- min: "0",
160
- step: "0.01",
161
- value: d.value,
162
- onChange: (e) => h(f, "value", parseFloat(e.target.value) || 0)
163
- })]
186
+ children: [
187
+ /* @__PURE__ */ c(a, {
188
+ htmlFor: `item-value-${d.id}`,
189
+ children: "Value ($)"
190
+ }),
191
+ /* @__PURE__ */ c(i, {
192
+ id: `item-value-${d.id}`,
193
+ type: "number",
194
+ min: "0",
195
+ step: "0.01",
196
+ value: d.value,
197
+ onChange: (e) => b(f, "value", parseFloat(e.target.value) || 0),
198
+ "aria-invalid": !!y.value,
199
+ "aria-describedby": y.value ? `item-value-${d.id}-error` : void 0
200
+ }),
201
+ A("value")
202
+ ]
164
203
  })
165
204
  ]
166
205
  }),
@@ -171,7 +210,7 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
171
210
  className: "px-1 text-xs font-medium text-text-secondary",
172
211
  children: [
173
212
  "Dimensions (",
174
- S.unit,
213
+ D.unit,
175
214
  ")"
176
215
  ]
177
216
  }),
@@ -183,17 +222,23 @@ function d({ item: d, index: f, products: p, productsLoading: m, onUpdate: h, on
183
222
  "height"
184
223
  ].map((e) => /* @__PURE__ */ l("div", {
185
224
  className: "space-y-2",
186
- children: [/* @__PURE__ */ c(a, {
187
- htmlFor: `item-${e}-${d.id}`,
188
- children: e.charAt(0).toUpperCase() + e.slice(1)
189
- }), /* @__PURE__ */ c(i, {
190
- id: `item-${e}-${d.id}`,
191
- type: "number",
192
- min: "0",
193
- step: "0.1",
194
- value: S[e],
195
- onChange: (t) => w(e, t.target.value)
196
- })]
225
+ children: [
226
+ /* @__PURE__ */ c(a, {
227
+ htmlFor: `item-${e}-${d.id}`,
228
+ children: e.charAt(0).toUpperCase() + e.slice(1)
229
+ }),
230
+ /* @__PURE__ */ c(i, {
231
+ id: `item-${e}-${d.id}`,
232
+ type: "number",
233
+ min: "0",
234
+ step: "0.1",
235
+ value: D[e],
236
+ onChange: (t) => k(e, t.target.value),
237
+ "aria-invalid": !!y[e],
238
+ "aria-describedby": y[e] ? `item-${e}-${d.id}-error` : void 0
239
+ }),
240
+ A(e)
241
+ ]
197
242
  }, e))
198
243
  }),
199
244
  /* @__PURE__ */ c("p", {