@jcsoftdev/ui 0.8.0 → 0.9.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.
@@ -44,6 +44,26 @@ export interface UiStrings {
44
44
  rotate: string;
45
45
  /** Keyboard help of an editable `FloorPlan`. */
46
46
  floorPlanEditHint: string;
47
+ orderTicketNumber: string;
48
+ orderTicketGuests: string;
49
+ orderTicketGuestsOne: string;
50
+ orderTicketPart: string;
51
+ orderTicketContinued: string;
52
+ orderTicketOnTime: string;
53
+ orderTicketDueSoon: string;
54
+ orderTicketLate: string;
55
+ orderTicketLateBy: string;
56
+ orderTicketProgress: string;
57
+ orderTicketProgressValue: string;
58
+ orderTicketItems: string;
59
+ orderTicketPending: string;
60
+ orderTicketInProgress: string;
61
+ orderTicketDone: string;
62
+ orderTicketNote: string;
63
+ orderTicketAllergy: string;
64
+ orderTicketRecovered: string;
65
+ orderTicketStartAll: string;
66
+ orderTicketReadyAll: string;
47
67
  remove: string;
48
68
  noResults: string;
49
69
  clear: string;
@@ -193,6 +213,26 @@ export declare const uiStrings: {
193
213
  readonly floorPlan: "Floor plan";
194
214
  readonly rotate: "Rotate 90°";
195
215
  readonly floorPlanEditHint: "Alt with arrows moves, Alt and Shift with arrows resizes, R rotates.";
216
+ readonly orderTicketNumber: "No. {number}";
217
+ readonly orderTicketGuests: "{count} guests";
218
+ readonly orderTicketGuestsOne: "{count} guest";
219
+ readonly orderTicketPart: "({index} of {count})";
220
+ readonly orderTicketContinued: "(cont.)";
221
+ readonly orderTicketOnTime: "on time";
222
+ readonly orderTicketDueSoon: "due soon";
223
+ readonly orderTicketLate: "late";
224
+ readonly orderTicketLateBy: "Late +{time}";
225
+ readonly orderTicketProgress: "Time against the {target} min target";
226
+ readonly orderTicketProgressValue: "{elapsed} of {target} min";
227
+ readonly orderTicketItems: "Items";
228
+ readonly orderTicketPending: "Queued";
229
+ readonly orderTicketInProgress: "Preparing";
230
+ readonly orderTicketDone: "Ready";
231
+ readonly orderTicketNote: "Note: {note}";
232
+ readonly orderTicketAllergy: "Allergy: {allergy}";
233
+ readonly orderTicketRecovered: "Recalled";
234
+ readonly orderTicketStartAll: "Start all";
235
+ readonly orderTicketReadyAll: "All ready";
196
236
  readonly remove: "Remove";
197
237
  readonly noResults: "No results";
198
238
  readonly clear: "Clear";
@@ -294,6 +334,26 @@ export declare const uiStrings: {
294
334
  readonly floorPlan: "Plano de sala";
295
335
  readonly rotate: "Girar 90°";
296
336
  readonly floorPlanEditHint: "Alt con flechas mueve, Alt y Mayús con flechas cambia el tamaño, R gira.";
337
+ readonly orderTicketNumber: "N.º {number}";
338
+ readonly orderTicketGuests: "{count} personas";
339
+ readonly orderTicketGuestsOne: "{count} persona";
340
+ readonly orderTicketPart: "({index} de {count})";
341
+ readonly orderTicketContinued: "(cont.)";
342
+ readonly orderTicketOnTime: "a tiempo";
343
+ readonly orderTicketDueSoon: "por vencer";
344
+ readonly orderTicketLate: "demorada";
345
+ readonly orderTicketLateBy: "Demorada +{time}";
346
+ readonly orderTicketProgress: "Tiempo contra los {target} min objetivo";
347
+ readonly orderTicketProgressValue: "{elapsed} de {target} min";
348
+ readonly orderTicketItems: "Platos";
349
+ readonly orderTicketPending: "En cola";
350
+ readonly orderTicketInProgress: "Preparando";
351
+ readonly orderTicketDone: "Listo";
352
+ readonly orderTicketNote: "Nota: {note}";
353
+ readonly orderTicketAllergy: "Alergia: {allergy}";
354
+ readonly orderTicketRecovered: "Recuperada";
355
+ readonly orderTicketStartAll: "Empezar todo";
356
+ readonly orderTicketReadyAll: "Listo todo";
297
357
  readonly remove: "Quitar";
298
358
  readonly noResults: "Sin resultados";
299
359
  readonly clear: "Limpiar";
@@ -33,6 +33,26 @@ const uiStrings = {
33
33
  floorPlan: "Floor plan",
34
34
  rotate: "Rotate 90\xB0",
35
35
  floorPlanEditHint: "Alt with arrows moves, Alt and Shift with arrows resizes, R rotates.",
36
+ orderTicketNumber: "No. {number}",
37
+ orderTicketGuests: "{count} guests",
38
+ orderTicketGuestsOne: "{count} guest",
39
+ orderTicketPart: "({index} of {count})",
40
+ orderTicketContinued: "(cont.)",
41
+ orderTicketOnTime: "on time",
42
+ orderTicketDueSoon: "due soon",
43
+ orderTicketLate: "late",
44
+ orderTicketLateBy: "Late +{time}",
45
+ orderTicketProgress: "Time against the {target} min target",
46
+ orderTicketProgressValue: "{elapsed} of {target} min",
47
+ orderTicketItems: "Items",
48
+ orderTicketPending: "Queued",
49
+ orderTicketInProgress: "Preparing",
50
+ orderTicketDone: "Ready",
51
+ orderTicketNote: "Note: {note}",
52
+ orderTicketAllergy: "Allergy: {allergy}",
53
+ orderTicketRecovered: "Recalled",
54
+ orderTicketStartAll: "Start all",
55
+ orderTicketReadyAll: "All ready",
36
56
  remove: "Remove",
37
57
  noResults: "No results",
38
58
  clear: "Clear",
@@ -134,6 +154,26 @@ const uiStrings = {
134
154
  floorPlan: "Plano de sala",
135
155
  rotate: "Girar 90\xB0",
136
156
  floorPlanEditHint: "Alt con flechas mueve, Alt y May\xFAs con flechas cambia el tama\xF1o, R gira.",
157
+ orderTicketNumber: "N.\xBA {number}",
158
+ orderTicketGuests: "{count} personas",
159
+ orderTicketGuestsOne: "{count} persona",
160
+ orderTicketPart: "({index} de {count})",
161
+ orderTicketContinued: "(cont.)",
162
+ orderTicketOnTime: "a tiempo",
163
+ orderTicketDueSoon: "por vencer",
164
+ orderTicketLate: "demorada",
165
+ orderTicketLateBy: "Demorada +{time}",
166
+ orderTicketProgress: "Tiempo contra los {target} min objetivo",
167
+ orderTicketProgressValue: "{elapsed} de {target} min",
168
+ orderTicketItems: "Platos",
169
+ orderTicketPending: "En cola",
170
+ orderTicketInProgress: "Preparando",
171
+ orderTicketDone: "Listo",
172
+ orderTicketNote: "Nota: {note}",
173
+ orderTicketAllergy: "Alergia: {allergy}",
174
+ orderTicketRecovered: "Recuperada",
175
+ orderTicketStartAll: "Empezar todo",
176
+ orderTicketReadyAll: "Listo todo",
137
177
  remove: "Quitar",
138
178
  noResults: "Sin resultados",
139
179
  clear: "Limpiar",
@@ -0,0 +1,2 @@
1
+ import { type IconProps } from "./icon-base.js";
2
+ export declare function AlarmClock(props: IconProps): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { IconBase } from "./icon-base.js";
3
+ function AlarmClock(props) {
4
+ return /* @__PURE__ */ jsxs(IconBase, { ...props, children: [
5
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "13", r: "8" }),
6
+ /* @__PURE__ */ jsx("path", { d: "M12 9v4l2 2" }),
7
+ /* @__PURE__ */ jsx("path", { d: "M5 3 2 6" }),
8
+ /* @__PURE__ */ jsx("path", { d: "m22 6-3-3" }),
9
+ /* @__PURE__ */ jsx("path", { d: "M6.38 18.7 4 21" }),
10
+ /* @__PURE__ */ jsx("path", { d: "M17.64 18.67 20 21" })
11
+ ] });
12
+ }
13
+ export {
14
+ AlarmClock
15
+ };
@@ -0,0 +1,2 @@
1
+ import { type IconProps } from "./icon-base.js";
2
+ export declare function Hourglass(props: IconProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { IconBase } from "./icon-base.js";
3
+ function Hourglass(props) {
4
+ return /* @__PURE__ */ jsxs(IconBase, { ...props, children: [
5
+ /* @__PURE__ */ jsx("path", { d: "M5 22h14" }),
6
+ /* @__PURE__ */ jsx("path", { d: "M5 2h14" }),
7
+ /* @__PURE__ */ jsx("path", { d: "M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22" }),
8
+ /* @__PURE__ */ jsx("path", { d: "M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2" })
9
+ ] });
10
+ }
11
+ export {
12
+ Hourglass
13
+ };
@@ -1,4 +1,5 @@
1
1
  export { type IconComponent, type IconProps, type LucideIcon } from "./icon-base.js";
2
+ export { AlarmClock } from "./alarm-clock.js";
2
3
  export { AlertTriangle } from "./alert-triangle.js";
3
4
  export { Archive } from "./archive.js";
4
5
  export { Armchair } from "./armchair.js";
@@ -69,6 +70,7 @@ export { Funnel } from "./funnel.js";
69
70
  export { GraduationCap } from "./graduation-cap.js";
70
71
  export { GripVertical } from "./grip-vertical.js";
71
72
  export { Heading2 } from "./heading-2.js";
73
+ export { Hourglass } from "./hourglass.js";
72
74
  export { House } from "./house.js";
73
75
  export { Inbox } from "./inbox.js";
74
76
  export { Info } from "./info.js";
@@ -1,4 +1,5 @@
1
1
  import {} from "./icon-base.js";
2
+ import { AlarmClock } from "./alarm-clock.js";
2
3
  import { AlertTriangle } from "./alert-triangle.js";
3
4
  import { Archive } from "./archive.js";
4
5
  import { Armchair } from "./armchair.js";
@@ -69,6 +70,7 @@ import { Funnel } from "./funnel.js";
69
70
  import { GraduationCap } from "./graduation-cap.js";
70
71
  import { GripVertical } from "./grip-vertical.js";
71
72
  import { Heading2 } from "./heading-2.js";
73
+ import { Hourglass } from "./hourglass.js";
72
74
  import { House } from "./house.js";
73
75
  import { Inbox } from "./inbox.js";
74
76
  import { Info } from "./info.js";
@@ -150,6 +152,7 @@ import { X } from "./x.js";
150
152
  import { XCircle } from "./xcircle.js";
151
153
  import { XOctagon } from "./xoctagon.js";
152
154
  export {
155
+ AlarmClock,
153
156
  AlertTriangle,
154
157
  Archive,
155
158
  Armchair,
@@ -220,6 +223,7 @@ export {
220
223
  GraduationCap,
221
224
  GripVertical,
222
225
  Heading2,
226
+ Hourglass,
223
227
  House,
224
228
  Inbox,
225
229
  Info,
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <circle cx="12" cy="13" r="8" />
3
+ <path d="M12 9v4l2 2" />
4
+ <path d="M5 3 2 6" />
5
+ <path d="m22 6-3-3" />
6
+ <path d="M6.38 18.7 4 21" />
7
+ <path d="M17.64 18.67 20 21" />
8
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M5 22h14" />
3
+ <path d="M5 2h14" />
4
+ <path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22" />
5
+ <path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2" />
6
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcsoftdev/ui",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Token-driven React component library: React 19, Tailwind v4.",
5
5
  "author": "jcsoftdev",
6
6
  "license": "MIT",
@@ -102,7 +102,7 @@
102
102
  "typescript": "^5.5.4",
103
103
  "vite": "7.3.6",
104
104
  "vitest": "4.1.11",
105
- "@jcsoftdev/ui-tokens": "^0.8.0"
105
+ "@jcsoftdev/ui-tokens": "^0.9.0"
106
106
  },
107
107
  "publishConfig": {
108
108
  "access": "public"
@@ -28,6 +28,7 @@ export * from "./kpi/index.js";
28
28
  export * from "./kpi-group/index.js";
29
29
  export * from "./list-detail/index.js";
30
30
  export * from "./note/index.js";
31
+ export * from "./order-ticket/index.js";
31
32
  export * from "./page/index.js";
32
33
  export * from "./page-header/index.js";
33
34
  export * from "./pagination/index.js";
@@ -0,0 +1,15 @@
1
+ export {
2
+ type OrderTicketLine,
3
+ type OrderTicketLineStatus,
4
+ type OrderTicketState,
5
+ orderTicketState,
6
+ splitTicketLines,
7
+ ticketLineCost,
8
+ warnLeadSeconds,
9
+ } from "./model.js";
10
+ export {
11
+ OrderTicket,
12
+ type OrderTicketChannel,
13
+ type OrderTicketPart,
14
+ type OrderTicketProps,
15
+ } from "./order-ticket.js";
@@ -0,0 +1,55 @@
1
+ export type OrderTicketState = "ok" | "warn" | "late";
2
+
3
+ export type OrderTicketLineStatus = "pending" | "in-progress" | "done";
4
+
5
+ export interface OrderTicketLine {
6
+ id: string;
7
+ qty: number;
8
+ name: string;
9
+ modifiers?: readonly string[] | undefined;
10
+ note?: string | undefined;
11
+ allergy?: string | undefined;
12
+ status?: OrderTicketLineStatus | undefined;
13
+ onToggle?: (() => void) | undefined;
14
+ }
15
+
16
+ const MIN_WARN_LEAD_SECONDS = 120;
17
+ const WARN_LEAD_SHARE = 0.25;
18
+
19
+ export function warnLeadSeconds(targetMinutes: number): number {
20
+ return Math.max(MIN_WARN_LEAD_SECONDS, targetMinutes * 60 * WARN_LEAD_SHARE);
21
+ }
22
+
23
+ export function orderTicketState(elapsedSeconds: number, targetMinutes: number): OrderTicketState {
24
+ const target = targetMinutes * 60;
25
+ if (elapsedSeconds > target) return "late";
26
+ if (elapsedSeconds >= target - warnLeadSeconds(targetMinutes)) return "warn";
27
+ return "ok";
28
+ }
29
+
30
+ type LineShape = Pick<OrderTicketLine, "modifiers" | "note" | "allergy">;
31
+
32
+ export function ticketLineCost(line: LineShape): number {
33
+ return 1 + (line.modifiers?.length ? 0.6 : 0) + (line.note ? 0.9 : 0) + (line.allergy ? 0.9 : 0);
34
+ }
35
+
36
+ export function splitTicketLines<Line extends LineShape>(
37
+ lines: readonly Line[],
38
+ budget: number,
39
+ cost: (line: Line) => number = ticketLineCost,
40
+ ): Line[][] {
41
+ const parts: Line[][] = [];
42
+ let used = 0;
43
+ for (const line of lines) {
44
+ const weight = cost(line);
45
+ const current = parts.at(-1);
46
+ if (current && used + weight <= budget) {
47
+ current.push(line);
48
+ used += weight;
49
+ } else {
50
+ parts.push([line]);
51
+ used = weight;
52
+ }
53
+ }
54
+ return parts;
55
+ }