@jcsoftdev/ui 0.7.1 → 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.
- package/CHANGELOG.md +60 -0
- package/README.md +4 -0
- package/dist/atoms/elapsed-time/elapsed-time.d.ts +29 -0
- package/dist/atoms/elapsed-time/elapsed-time.js +65 -0
- package/dist/atoms/elapsed-time/index.d.ts +2 -0
- package/dist/atoms/elapsed-time/index.js +9 -0
- package/dist/atoms/elapsed-time/model.d.ts +17 -0
- package/dist/atoms/elapsed-time/model.js +37 -0
- package/dist/atoms/elapsed-time/ticker.d.ts +5 -0
- package/dist/atoms/elapsed-time/ticker.js +37 -0
- package/dist/atoms/index.d.ts +2 -0
- package/dist/atoms/index.js +2 -0
- package/dist/atoms/table-glyph/index.d.ts +2 -0
- package/dist/atoms/table-glyph/index.js +14 -0
- package/dist/atoms/table-glyph/layout.d.ts +38 -0
- package/dist/atoms/table-glyph/layout.js +152 -0
- package/dist/atoms/table-glyph/table-glyph.d.ts +32 -0
- package/dist/atoms/table-glyph/table-glyph.js +131 -0
- package/dist/containers/floor-plan/edit-model.d.ts +33 -0
- package/dist/containers/floor-plan/edit-model.js +82 -0
- package/dist/containers/floor-plan/floor-plan.d.ts +83 -0
- package/dist/containers/floor-plan/floor-plan.js +278 -0
- package/dist/containers/floor-plan/index.d.ts +3 -0
- package/dist/containers/floor-plan/index.js +21 -0
- package/dist/containers/floor-plan/model.d.ts +36 -0
- package/dist/containers/floor-plan/model.js +52 -0
- package/dist/containers/floor-plan/use-floor-plan-edit.d.ts +26 -0
- package/dist/containers/floor-plan/use-floor-plan-edit.js +97 -0
- package/dist/containers/index.d.ts +2 -0
- package/dist/containers/index.js +2 -0
- package/dist/containers/order-ticket/index.d.ts +2 -0
- package/dist/containers/order-ticket/index.js +16 -0
- package/dist/containers/order-ticket/model.d.ts +18 -0
- package/dist/containers/order-ticket/model.js +36 -0
- package/dist/containers/order-ticket/order-ticket.d.ts +34 -0
- package/dist/containers/order-ticket/order-ticket.js +390 -0
- package/dist/glass/crystal-map.d.ts +3 -1
- package/dist/glass/crystal-map.js +13 -2
- package/dist/i18n/strings.d.ts +104 -0
- package/dist/i18n/strings.js +62 -0
- package/dist/icons/alarm-clock.d.ts +2 -0
- package/dist/icons/alarm-clock.js +15 -0
- package/dist/icons/hourglass.d.ts +2 -0
- package/dist/icons/hourglass.js +13 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +4 -0
- package/icons/svg/alarm-clock.svg +8 -0
- package/icons/svg/hourglass.svg +6 -0
- package/package.json +2 -2
- package/src/atoms/elapsed-time/elapsed-time.tsx +101 -0
- package/src/atoms/elapsed-time/index.ts +6 -0
- package/src/atoms/elapsed-time/model.ts +54 -0
- package/src/atoms/elapsed-time/ticker.ts +39 -0
- package/src/atoms/index.ts +2 -0
- package/src/atoms/table-glyph/index.ts +14 -0
- package/src/atoms/table-glyph/layout.ts +187 -0
- package/src/atoms/table-glyph/table-glyph.tsx +161 -0
- package/src/containers/floor-plan/edit-model.ts +115 -0
- package/src/containers/floor-plan/floor-plan.tsx +393 -0
- package/src/containers/floor-plan/index.ts +20 -0
- package/src/containers/floor-plan/model.ts +81 -0
- package/src/containers/floor-plan/use-floor-plan-edit.ts +135 -0
- package/src/containers/index.ts +2 -0
- package/src/containers/order-ticket/index.ts +15 -0
- package/src/containers/order-ticket/model.ts +55 -0
- package/src/containers/order-ticket/order-ticket.tsx +463 -0
- package/src/glass/crystal-map.ts +21 -3
- package/src/i18n/strings.ts +104 -0
- package/src/icons/alarm-clock.tsx +16 -0
- package/src/icons/hourglass.tsx +14 -0
- package/src/icons/index.ts +2 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useSyncExternalStore } from "react";
|
|
4
|
+
import { Button } from "../../atoms/button/button.js";
|
|
5
|
+
import { Chip } from "../../atoms/chip/chip.js";
|
|
6
|
+
import { ElapsedTime } from "../../atoms/elapsed-time/elapsed-time.js";
|
|
7
|
+
import { readElapsed } from "../../atoms/elapsed-time/model.js";
|
|
8
|
+
import { getTickerSnapshot, subscribeTicker } from "../../atoms/elapsed-time/ticker.js";
|
|
9
|
+
import { Progress } from "../../atoms/progress/progress.js";
|
|
10
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
11
|
+
import {
|
|
12
|
+
AlarmClock,
|
|
13
|
+
CircleAlert,
|
|
14
|
+
CircleCheck,
|
|
15
|
+
Hourglass,
|
|
16
|
+
Play,
|
|
17
|
+
RotateCcw,
|
|
18
|
+
Square,
|
|
19
|
+
TriangleAlert
|
|
20
|
+
} from "../../icons/index.js";
|
|
21
|
+
import { cn } from "../../utils/cn.js";
|
|
22
|
+
import { usePrefersReducedMotion } from "../../utils/reduced-motion.js";
|
|
23
|
+
import {
|
|
24
|
+
orderTicketState
|
|
25
|
+
} from "./model.js";
|
|
26
|
+
const progressTone = {
|
|
27
|
+
ok: "accent",
|
|
28
|
+
warn: "warning",
|
|
29
|
+
late: "danger"
|
|
30
|
+
};
|
|
31
|
+
const timerTone = {
|
|
32
|
+
ok: "font-normal text-ink",
|
|
33
|
+
warn: "font-normal text-warning",
|
|
34
|
+
late: "font-normal text-current"
|
|
35
|
+
};
|
|
36
|
+
const stateWord = {
|
|
37
|
+
ok: "orderTicketOnTime",
|
|
38
|
+
warn: "orderTicketDueSoon",
|
|
39
|
+
late: "orderTicketLate"
|
|
40
|
+
};
|
|
41
|
+
const lineStateWord = {
|
|
42
|
+
pending: "orderTicketPending",
|
|
43
|
+
"in-progress": "orderTicketInProgress",
|
|
44
|
+
done: "orderTicketDone"
|
|
45
|
+
};
|
|
46
|
+
const lineStateIcon = {
|
|
47
|
+
pending: /* @__PURE__ */ jsx(Square, { size: 18, "aria-hidden": "true" }),
|
|
48
|
+
"in-progress": /* @__PURE__ */ jsx(Play, { size: 18, "aria-hidden": "true" }),
|
|
49
|
+
done: /* @__PURE__ */ jsx(CircleCheck, { size: 18, "aria-hidden": "true" })
|
|
50
|
+
};
|
|
51
|
+
const lineToneClasses = {
|
|
52
|
+
pending: "",
|
|
53
|
+
"in-progress": "bg-accent-soft",
|
|
54
|
+
done: ""
|
|
55
|
+
};
|
|
56
|
+
const lineStateClasses = {
|
|
57
|
+
pending: "text-ink-2",
|
|
58
|
+
"in-progress": "text-accent-ink",
|
|
59
|
+
done: "text-success"
|
|
60
|
+
};
|
|
61
|
+
const lineStateTextClasses = {
|
|
62
|
+
pending: "sr-only",
|
|
63
|
+
"in-progress": "sr-only @[340px]/ticket:not-sr-only",
|
|
64
|
+
done: "sr-only @[340px]/ticket:not-sr-only"
|
|
65
|
+
};
|
|
66
|
+
const pressedOf = {
|
|
67
|
+
pending: false,
|
|
68
|
+
"in-progress": "mixed",
|
|
69
|
+
done: true
|
|
70
|
+
};
|
|
71
|
+
const fill = (template, values) => Object.entries(values).reduce(
|
|
72
|
+
(text, [key, value]) => text.replace(`{${key}}`, String(value)),
|
|
73
|
+
template
|
|
74
|
+
);
|
|
75
|
+
const clock = (seconds) => `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
76
|
+
const noteClasses = "inline-flex max-w-full items-start gap-1 self-start rounded-chip px-1.5 py-0.5 text-meta font-medium [&_svg]:mt-0.5 [&_svg]:shrink-0";
|
|
77
|
+
function LineContent({
|
|
78
|
+
line,
|
|
79
|
+
status,
|
|
80
|
+
strings
|
|
81
|
+
}) {
|
|
82
|
+
const done = status === "done";
|
|
83
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
className: cn(
|
|
88
|
+
"text-right text-card-title tabular-nums",
|
|
89
|
+
done && "text-ink-2 line-through decoration-2"
|
|
90
|
+
),
|
|
91
|
+
children: line.qty
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
className: cn(
|
|
99
|
+
"text-card-title [overflow-wrap:anywhere]",
|
|
100
|
+
done && "text-ink-2 line-through decoration-2"
|
|
101
|
+
),
|
|
102
|
+
children: line.name
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
line.modifiers && line.modifiers.length > 0 && /* @__PURE__ */ jsx("span", { className: "text-meta text-ink-2 [overflow-wrap:anywhere]", children: line.modifiers.join(" \xB7 ") }),
|
|
106
|
+
line.note && /* @__PURE__ */ jsxs(
|
|
107
|
+
"span",
|
|
108
|
+
{
|
|
109
|
+
"data-part": "note",
|
|
110
|
+
className: cn(noteClasses, "text-ink shadow-[inset_0_0_0_1px_var(--line-strong)]"),
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx(TriangleAlert, { size: 14, "aria-hidden": "true" }),
|
|
113
|
+
fill(strings.orderTicketNote, { note: line.note })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
line.allergy && /* @__PURE__ */ jsxs(
|
|
118
|
+
"span",
|
|
119
|
+
{
|
|
120
|
+
"data-part": "allergy",
|
|
121
|
+
className: cn(
|
|
122
|
+
noteClasses,
|
|
123
|
+
"font-semibold text-danger shadow-[inset_0_0_0_1.5px_var(--danger)]"
|
|
124
|
+
),
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ jsx(CircleAlert, { size: 14, "aria-hidden": "true" }),
|
|
127
|
+
fill(strings.orderTicketAllergy, { allergy: line.allergy })
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ jsxs(
|
|
133
|
+
"span",
|
|
134
|
+
{
|
|
135
|
+
className: cn(
|
|
136
|
+
"inline-flex min-h-[1.4em] items-center justify-end gap-1.5 text-meta font-semibold",
|
|
137
|
+
lineStateClasses[status]
|
|
138
|
+
),
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ jsx("span", { className: lineStateTextClasses[status], children: strings[lineStateWord[status]] }),
|
|
141
|
+
lineStateIcon[status]
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] });
|
|
146
|
+
}
|
|
147
|
+
function TicketLineRow({
|
|
148
|
+
line,
|
|
149
|
+
readOnly,
|
|
150
|
+
strings,
|
|
151
|
+
className
|
|
152
|
+
}) {
|
|
153
|
+
const status = line.status ?? "pending";
|
|
154
|
+
const rowClasses = cn(
|
|
155
|
+
"grid min-h-[max(var(--touch-target),2rem)] w-full grid-cols-[2.4ch_minmax(0,1fr)_auto] items-start gap-x-2.5 rounded-control px-1.5 py-1 text-left text-ink",
|
|
156
|
+
lineToneClasses[status],
|
|
157
|
+
className
|
|
158
|
+
);
|
|
159
|
+
const content = /* @__PURE__ */ jsx(LineContent, { line, status, strings });
|
|
160
|
+
return /* @__PURE__ */ jsx("li", { "data-line": line.id, "data-status": status, children: line.onToggle && !readOnly ? /* @__PURE__ */ jsx(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
type: "button",
|
|
164
|
+
"aria-pressed": pressedOf[status],
|
|
165
|
+
onClick: line.onToggle,
|
|
166
|
+
className: cn(
|
|
167
|
+
rowClasses,
|
|
168
|
+
"cursor-pointer transition-colors focus-visible:focus-ring motion-reduce:transition-none",
|
|
169
|
+
status !== "in-progress" && "hover:bg-surface-2"
|
|
170
|
+
),
|
|
171
|
+
children: content
|
|
172
|
+
}
|
|
173
|
+
) : /* @__PURE__ */ jsx("div", { className: rowClasses, children: content }) });
|
|
174
|
+
}
|
|
175
|
+
function OrderTicket({
|
|
176
|
+
table,
|
|
177
|
+
number,
|
|
178
|
+
channel,
|
|
179
|
+
guests,
|
|
180
|
+
server,
|
|
181
|
+
customer,
|
|
182
|
+
since,
|
|
183
|
+
targetMinutes,
|
|
184
|
+
serverOffsetMs,
|
|
185
|
+
state: stateProp,
|
|
186
|
+
lines,
|
|
187
|
+
partIndex,
|
|
188
|
+
partCount,
|
|
189
|
+
recovered,
|
|
190
|
+
chip,
|
|
191
|
+
readOnly = false,
|
|
192
|
+
onStartAll,
|
|
193
|
+
onReadyAll,
|
|
194
|
+
actions,
|
|
195
|
+
hanging,
|
|
196
|
+
headingLevel = 3,
|
|
197
|
+
viewTransitionName,
|
|
198
|
+
classNames,
|
|
199
|
+
className,
|
|
200
|
+
style,
|
|
201
|
+
...props
|
|
202
|
+
}) {
|
|
203
|
+
const strings = useUiStrings();
|
|
204
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
205
|
+
const headingId = useId();
|
|
206
|
+
const now = useSyncExternalStore(subscribeTicker, getTickerSnapshot, getTickerSnapshot);
|
|
207
|
+
const { seconds } = readElapsed({ since, now, serverOffsetMs });
|
|
208
|
+
const targetSeconds = Math.max(1, targetMinutes * 60);
|
|
209
|
+
const state = stateProp ?? orderTicketState(seconds, targetMinutes);
|
|
210
|
+
const late = state === "late";
|
|
211
|
+
const overrun = Math.max(0, seconds - targetSeconds);
|
|
212
|
+
const Heading = `h${headingLevel}`;
|
|
213
|
+
const title = table ?? fill(strings.orderTicketNumber, { number: number ?? "" });
|
|
214
|
+
const titleIcon = table ? null : channel?.icon;
|
|
215
|
+
const guestsText = guests === void 0 ? void 0 : fill(guests === 1 ? strings.orderTicketGuestsOne : strings.orderTicketGuests, {
|
|
216
|
+
count: guests
|
|
217
|
+
});
|
|
218
|
+
const meta = [table ? void 0 : channel?.label, guestsText, server, customer].filter(Boolean).join(" \xB7 ");
|
|
219
|
+
const split = partCount !== void 0 && partCount > 1;
|
|
220
|
+
const partLabel = split && (partIndex ?? 1) > 1 ? strings.orderTicketContinued : fill(strings.orderTicketPart, { index: 1, count: partCount ?? 1 });
|
|
221
|
+
const overrunText = reducedMotion ? fill(strings.minutesShort, { count: Math.ceil(overrun / 60) }) : clock(overrun);
|
|
222
|
+
const showActions = !readOnly && Boolean(actions || onStartAll || onReadyAll);
|
|
223
|
+
return /* @__PURE__ */ jsx(
|
|
224
|
+
"article",
|
|
225
|
+
{
|
|
226
|
+
"aria-labelledby": headingId,
|
|
227
|
+
"data-state": state,
|
|
228
|
+
"data-read-only": readOnly ? "" : void 0,
|
|
229
|
+
"data-part-index": split ? partIndex ?? 1 : void 0,
|
|
230
|
+
className: cn(
|
|
231
|
+
"@container/ticket relative min-w-0 [--ticket-edge:var(--hair)] data-[state=late]:[--ticket-edge:var(--danger)]",
|
|
232
|
+
"[filter:drop-shadow(1px_0_0_var(--ticket-edge))_drop-shadow(-1px_0_0_var(--ticket-edge))_drop-shadow(0_1px_0_var(--ticket-edge))_drop-shadow(0_-1px_0_var(--ticket-edge))]",
|
|
233
|
+
hanging && "pt-2.5 before:absolute before:top-0 before:left-1/2 before:z-1 before:h-4 before:w-11 before:-translate-x-1/2 before:rounded-[4px_4px_2px_2px] before:bg-line-strong before:shadow-[inset_0_-3px_0_var(--sunken)] before:content-['']",
|
|
234
|
+
classNames?.root,
|
|
235
|
+
className
|
|
236
|
+
),
|
|
237
|
+
style: viewTransitionName ? { ...style, viewTransitionName } : style,
|
|
238
|
+
...props,
|
|
239
|
+
children: /* @__PURE__ */ jsxs(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
"data-part": "paper",
|
|
243
|
+
className: cn(
|
|
244
|
+
"relative flex flex-col gap-2.5 rounded-t-card bg-surface p-3 pb-[calc(--spacing(3)+6px)] text-ink",
|
|
245
|
+
"[mask:conic-gradient(from_-45deg_at_bottom,transparent,black_1deg_89deg,transparent_90deg)_50%/12px_100%]",
|
|
246
|
+
classNames?.paper
|
|
247
|
+
),
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ jsxs(
|
|
250
|
+
"div",
|
|
251
|
+
{
|
|
252
|
+
"data-part": "band",
|
|
253
|
+
className: cn(
|
|
254
|
+
"-mx-3 -mt-3 flex flex-col gap-1.5 rounded-t-card px-3 pt-3 pb-2.5",
|
|
255
|
+
hanging && "pt-4",
|
|
256
|
+
late && "bg-danger text-surface",
|
|
257
|
+
classNames?.band
|
|
258
|
+
),
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ jsxs("header", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-3", children: [
|
|
261
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2", children: [
|
|
262
|
+
/* @__PURE__ */ jsxs(
|
|
263
|
+
Heading,
|
|
264
|
+
{
|
|
265
|
+
id: headingId,
|
|
266
|
+
className: cn(
|
|
267
|
+
"m-0 inline-flex items-center gap-1.5 text-kpi-number text-balance [overflow-wrap:anywhere] [&_svg]:shrink-0",
|
|
268
|
+
classNames?.title
|
|
269
|
+
),
|
|
270
|
+
children: [
|
|
271
|
+
titleIcon,
|
|
272
|
+
/* @__PURE__ */ jsx("span", { children: title }),
|
|
273
|
+
split && /* @__PURE__ */ jsx("span", { className: "text-control", children: partLabel }),
|
|
274
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: `, ${strings[stateWord[state]]}` })
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
meta && /* @__PURE__ */ jsx(
|
|
279
|
+
"span",
|
|
280
|
+
{
|
|
281
|
+
className: cn(
|
|
282
|
+
"min-w-0 text-meta",
|
|
283
|
+
late ? "text-current" : "text-ink-2",
|
|
284
|
+
classNames?.meta
|
|
285
|
+
),
|
|
286
|
+
children: meta
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsxs(
|
|
291
|
+
"span",
|
|
292
|
+
{
|
|
293
|
+
className: cn(
|
|
294
|
+
"inline-flex items-center gap-1 whitespace-nowrap",
|
|
295
|
+
state === "warn" && "text-warning",
|
|
296
|
+
classNames?.timer
|
|
297
|
+
),
|
|
298
|
+
children: [
|
|
299
|
+
state === "warn" && /* @__PURE__ */ jsx(Hourglass, { size: 18, "aria-hidden": "true" }),
|
|
300
|
+
/* @__PURE__ */ jsx(
|
|
301
|
+
ElapsedTime,
|
|
302
|
+
{
|
|
303
|
+
since,
|
|
304
|
+
...serverOffsetMs === void 0 ? {} : { serverOffsetMs },
|
|
305
|
+
className: cn("text-kpi-number", timerTone[state])
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] }),
|
|
312
|
+
late && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 text-row-title", children: [
|
|
313
|
+
/* @__PURE__ */ jsx(AlarmClock, { size: 18, "aria-hidden": "true" }),
|
|
314
|
+
fill(strings.orderTicketLateBy, { time: overrunText })
|
|
315
|
+
] })
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ jsx(
|
|
320
|
+
Progress,
|
|
321
|
+
{
|
|
322
|
+
value: Math.min(seconds, targetSeconds),
|
|
323
|
+
max: targetSeconds,
|
|
324
|
+
tone: progressTone[state],
|
|
325
|
+
"aria-label": fill(strings.orderTicketProgress, { target: targetMinutes }),
|
|
326
|
+
getValueLabel: () => fill(strings.orderTicketProgressValue, {
|
|
327
|
+
elapsed: Math.floor(seconds / 60),
|
|
328
|
+
target: targetMinutes
|
|
329
|
+
}),
|
|
330
|
+
className: classNames?.progress
|
|
331
|
+
}
|
|
332
|
+
),
|
|
333
|
+
recovered && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: /* @__PURE__ */ jsx(Chip, { tone: "info", icon: /* @__PURE__ */ jsx(RotateCcw, { size: 14, "aria-hidden": "true" }), children: strings.orderTicketRecovered }) }),
|
|
334
|
+
/* @__PURE__ */ jsx(
|
|
335
|
+
"ul",
|
|
336
|
+
{
|
|
337
|
+
"aria-label": strings.orderTicketItems,
|
|
338
|
+
className: cn("-mx-1.5 my-0 flex list-none flex-col gap-0.5 p-0", classNames?.lines),
|
|
339
|
+
children: lines.map((line) => /* @__PURE__ */ jsx(
|
|
340
|
+
TicketLineRow,
|
|
341
|
+
{
|
|
342
|
+
line,
|
|
343
|
+
readOnly,
|
|
344
|
+
strings,
|
|
345
|
+
className: classNames?.line
|
|
346
|
+
},
|
|
347
|
+
line.id
|
|
348
|
+
))
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
(chip || showActions) && /* @__PURE__ */ jsxs(
|
|
352
|
+
"footer",
|
|
353
|
+
{
|
|
354
|
+
className: cn(
|
|
355
|
+
"flex items-center gap-2 border-t border-dashed border-line-strong pt-2.5",
|
|
356
|
+
classNames?.footer
|
|
357
|
+
),
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 grow flex-wrap gap-1.5 @max-[310px]/ticket:hidden", children: chip && /* @__PURE__ */ jsx(Chip, { tone: "neutral", className: "min-w-0", children: chip }) }),
|
|
360
|
+
showActions && actions,
|
|
361
|
+
showActions && onStartAll && /* @__PURE__ */ jsx(
|
|
362
|
+
Button,
|
|
363
|
+
{
|
|
364
|
+
variant: onReadyAll ? "secondary" : "primary",
|
|
365
|
+
className: "whitespace-nowrap @max-[310px]/ticket:flex-1",
|
|
366
|
+
onClick: () => onStartAll(lines),
|
|
367
|
+
children: strings.orderTicketStartAll
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
showActions && onReadyAll && /* @__PURE__ */ jsx(
|
|
371
|
+
Button,
|
|
372
|
+
{
|
|
373
|
+
variant: "primary",
|
|
374
|
+
className: "whitespace-nowrap @max-[310px]/ticket:flex-1",
|
|
375
|
+
onClick: () => onReadyAll(lines),
|
|
376
|
+
children: strings.orderTicketReadyAll
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
export {
|
|
389
|
+
OrderTicket
|
|
390
|
+
};
|
|
@@ -49,7 +49,9 @@ export interface CrystalMapOptions {
|
|
|
49
49
|
* Margin past each side of the surface, in px (default: `margin` on all four). A surface inside
|
|
50
50
|
* a clipping ancestor (an `overflow` or `clip-path` stage) only has the backdrop within it: a
|
|
51
51
|
* layer that reaches past the clip is cut by the browser and its filter is shifted, so the map
|
|
52
|
-
* covers only the backdrop that exists
|
|
52
|
+
* covers only the backdrop that exists. A side with less room than the margin scales its offsets
|
|
53
|
+
* down so its silhouette still samples inside the room, eased across the surface; the hard clamp
|
|
54
|
+
* that remains only bites in the margin, which the layer clips away.
|
|
53
55
|
*/
|
|
54
56
|
room?: Partial<Record<"left" | "right" | "top" | "bottom", number>>;
|
|
55
57
|
/** Largest factor the offset is multiplied by (chromatic dispersion pulls red this much further). Default 1. */
|
|
@@ -44,15 +44,26 @@ function computeCrystalField({
|
|
|
44
44
|
const [minY, maxY] = [-hy - top + slack, hy + bottom - slack];
|
|
45
45
|
const unit = Math.max(amplitude, 1e-6);
|
|
46
46
|
const f = Math.max(reach, 1);
|
|
47
|
+
const keep = (free2, extent) => free2 >= m ? 1 : clamp((free2 - EDGE_SLACK) / Math.max(f * unit * extent / half, 1e-6), 0, 1);
|
|
48
|
+
const shares = {
|
|
49
|
+
x: [keep(left, hx), keep(right, hx)],
|
|
50
|
+
y: [keep(top, hy), keep(bottom, hy)]
|
|
51
|
+
};
|
|
52
|
+
const share = ([low, high], p, extent) => {
|
|
53
|
+
const u = clamp((p + extent) / (2 * extent), 0, 1);
|
|
54
|
+
return low + (high - low) * u * u * (3 - 2 * u);
|
|
55
|
+
};
|
|
47
56
|
const within = (p, offset, lo, hi) => clamp((bounded ? clamp(offset, (lo - p) / f, (hi - p) / f) : offset) / unit, -1, 1);
|
|
48
57
|
for (let j = 0; j < ph; j++) {
|
|
49
58
|
const py = (j + 0.5) / ry - top - hy;
|
|
59
|
+
const ky = share(shares.y, py, hy);
|
|
50
60
|
for (let i = 0; i < pw; i++) {
|
|
51
61
|
const px = (i + 0.5) / rx - left - hx;
|
|
62
|
+
const kx = share(shares.x, px, hx);
|
|
52
63
|
const s = crystalShape(crystalRadius(px, py, hx, hy));
|
|
53
64
|
const o = (j * pw + i) * 4;
|
|
54
|
-
data[o] = 128 + within(px, s * px * amplitude / half, minX, maxX) * 127;
|
|
55
|
-
data[o + 1] = 128 + within(py, s * py * amplitude / half, minY, maxY) * 127;
|
|
65
|
+
data[o] = 128 + within(px, s * px * amplitude / half * kx, minX, maxX) * 127;
|
|
66
|
+
data[o + 1] = 128 + within(py, s * py * amplitude / half * ky, minY, maxY) * 127;
|
|
56
67
|
data[o + 2] = 255;
|
|
57
68
|
data[o + 3] = 255;
|
|
58
69
|
}
|
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -22,6 +22,48 @@ export interface UiStrings {
|
|
|
22
22
|
more: string;
|
|
23
23
|
/** Accessible total on the bottom bar "More" button; `{count}` is replaced. */
|
|
24
24
|
morePending: string;
|
|
25
|
+
/** Accessible text of an `ElapsedTime` at exactly one minute; `{count}` is replaced. */
|
|
26
|
+
elapsedMinutesOne: string;
|
|
27
|
+
/** Accessible text of an `ElapsedTime`; `{count}` is replaced. */
|
|
28
|
+
elapsedMinutes: string;
|
|
29
|
+
/** Visible text of an `ElapsedTime` with `format="minutes"`; `{count}` is replaced. */
|
|
30
|
+
minutesShort: string;
|
|
31
|
+
/** Accessible text of a countdown `ElapsedTime`; `{time}` is the remaining time. */
|
|
32
|
+
countdownLeft: string;
|
|
33
|
+
/** Accessible text of a countdown `ElapsedTime` past its target; `{time}` is the overrun. */
|
|
34
|
+
countdownOver: string;
|
|
35
|
+
/** Seat count of a floor plan table; `{count}` is replaced. */
|
|
36
|
+
seats: string;
|
|
37
|
+
/** Seat count of a one-seat floor plan table; `{count}` is replaced. */
|
|
38
|
+
seatsOne: string;
|
|
39
|
+
/** Screen-reader state of a floor plan item ringed as late. */
|
|
40
|
+
late: string;
|
|
41
|
+
/** Default accessible name of a `FloorPlan`. */
|
|
42
|
+
floorPlan: string;
|
|
43
|
+
/** Accessible name of the rotate button of an editable `FloorPlan` item. */
|
|
44
|
+
rotate: string;
|
|
45
|
+
/** Keyboard help of an editable `FloorPlan`. */
|
|
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;
|
|
25
67
|
remove: string;
|
|
26
68
|
noResults: string;
|
|
27
69
|
clear: string;
|
|
@@ -160,6 +202,37 @@ export declare const uiStrings: {
|
|
|
160
202
|
readonly copied: "Copied";
|
|
161
203
|
readonly more: "More";
|
|
162
204
|
readonly morePending: "{count} pending";
|
|
205
|
+
readonly elapsedMinutesOne: "{count} minute";
|
|
206
|
+
readonly elapsedMinutes: "{count} minutes";
|
|
207
|
+
readonly minutesShort: "{count} min";
|
|
208
|
+
readonly countdownLeft: "{time} left";
|
|
209
|
+
readonly countdownOver: "{time} over";
|
|
210
|
+
readonly seats: "{count} seats";
|
|
211
|
+
readonly seatsOne: "{count} seat";
|
|
212
|
+
readonly late: "Late";
|
|
213
|
+
readonly floorPlan: "Floor plan";
|
|
214
|
+
readonly rotate: "Rotate 90°";
|
|
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";
|
|
163
236
|
readonly remove: "Remove";
|
|
164
237
|
readonly noResults: "No results";
|
|
165
238
|
readonly clear: "Clear";
|
|
@@ -250,6 +323,37 @@ export declare const uiStrings: {
|
|
|
250
323
|
readonly copied: "Copiado";
|
|
251
324
|
readonly more: "Más";
|
|
252
325
|
readonly morePending: "{count} pendientes";
|
|
326
|
+
readonly elapsedMinutesOne: "{count} minuto";
|
|
327
|
+
readonly elapsedMinutes: "{count} minutos";
|
|
328
|
+
readonly minutesShort: "{count} min";
|
|
329
|
+
readonly countdownLeft: "faltan {time}";
|
|
330
|
+
readonly countdownOver: "{time} de retraso";
|
|
331
|
+
readonly seats: "{count} asientos";
|
|
332
|
+
readonly seatsOne: "{count} asiento";
|
|
333
|
+
readonly late: "Con retraso";
|
|
334
|
+
readonly floorPlan: "Plano de sala";
|
|
335
|
+
readonly rotate: "Girar 90°";
|
|
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";
|
|
253
357
|
readonly remove: "Quitar";
|
|
254
358
|
readonly noResults: "Sin resultados";
|
|
255
359
|
readonly clear: "Limpiar";
|
package/dist/i18n/strings.js
CHANGED
|
@@ -22,6 +22,37 @@ const uiStrings = {
|
|
|
22
22
|
copied: "Copied",
|
|
23
23
|
more: "More",
|
|
24
24
|
morePending: "{count} pending",
|
|
25
|
+
elapsedMinutesOne: "{count} minute",
|
|
26
|
+
elapsedMinutes: "{count} minutes",
|
|
27
|
+
minutesShort: "{count} min",
|
|
28
|
+
countdownLeft: "{time} left",
|
|
29
|
+
countdownOver: "{time} over",
|
|
30
|
+
seats: "{count} seats",
|
|
31
|
+
seatsOne: "{count} seat",
|
|
32
|
+
late: "Late",
|
|
33
|
+
floorPlan: "Floor plan",
|
|
34
|
+
rotate: "Rotate 90\xB0",
|
|
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",
|
|
25
56
|
remove: "Remove",
|
|
26
57
|
noResults: "No results",
|
|
27
58
|
clear: "Clear",
|
|
@@ -112,6 +143,37 @@ const uiStrings = {
|
|
|
112
143
|
copied: "Copiado",
|
|
113
144
|
more: "M\xE1s",
|
|
114
145
|
morePending: "{count} pendientes",
|
|
146
|
+
elapsedMinutesOne: "{count} minuto",
|
|
147
|
+
elapsedMinutes: "{count} minutos",
|
|
148
|
+
minutesShort: "{count} min",
|
|
149
|
+
countdownLeft: "faltan {time}",
|
|
150
|
+
countdownOver: "{time} de retraso",
|
|
151
|
+
seats: "{count} asientos",
|
|
152
|
+
seatsOne: "{count} asiento",
|
|
153
|
+
late: "Con retraso",
|
|
154
|
+
floorPlan: "Plano de sala",
|
|
155
|
+
rotate: "Girar 90\xB0",
|
|
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",
|
|
115
177
|
remove: "Quitar",
|
|
116
178
|
noResults: "Sin resultados",
|
|
117
179
|
clear: "Limpiar",
|
|
@@ -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,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
|
+
};
|