@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0 (2026-11-04)
4
+
5
+ ### Kitchen ticket
6
+
7
+ A paper-style kitchen display ticket for order queues and wall screens.
8
+
9
+ #### Added
10
+
11
+ - **`OrderTicket`** (`containers`): a ticket with a table title, or the channel icon plus «N.º n» for
12
+ orders without a table, and a meta line with channel, guests and server. The header shows the
13
+ elapsed time and progress against `targetMinutes`. `warn` uses an hourglass and warning text.
14
+ `late` fills the header band with danger and shows «Demorada +m:ss». Lines carry quantity,
15
+ modifiers, note and an allergy callout (danger outline, never warning amber). Each line has a
16
+ toggle with `aria-pressed` for pending, in progress and done. «Empezar todo» and «Listo todo»
17
+ act only on the lines of the card shown. `readOnly` renders no buttons. `partIndex` and
18
+ `partCount` label continued tickets «(1 de n)» and «(cont.)». Also takes `recovered`, `chip`,
19
+ an `actions` slot and `viewTransitionName`. Motion is off under reduced motion.
20
+ - **Helpers**: `orderTicketState`, `warnLeadSeconds` (max of 2 minutes and 25% of the target),
21
+ `splitTicketLines` and `ticketLineCost`.
22
+ - **Icons**: `AlarmClock` and `Hourglass`.
23
+ - **UI strings** (en, es) for the ticket.
24
+
25
+ #### Changed
26
+
27
+ - **Size budgets raised** by about 2% for 13 entries that carry the larger string table or the new
28
+ container.
29
+
3
30
  ## 0.8.0 (2026-11-04)
4
31
 
5
32
  ### Floor plan
@@ -771,6 +798,7 @@ From 0.2.x: nothing changes unless you adopt Liquid Glass.
771
798
  ### Crystal lens
772
799
 
773
800
  - **`profile: "crystal"`** and the `crystal` preset (`data-glass="liquid-crystal"`): a thick, fully clear convex lens that minifies the backdrop, bends it hard towards the rim, splits colour at the edge and has no frost, veil or tint. `refraction` accepts 0 to 2 for it (defaults and the other profiles are unchanged; above 1 they behave as 1). The minifying map cannot fold; the filter runs on a layer that extends past the surface and is clipped to it. No contrast guarantee.
801
+ - **Crystal near the edge of a clipping ancestor.** A side with less backdrop than the lens reaches (a surface at the edge of an `overflow` or `clip-path` stage) now bends less on that side, eased across the surface, so its silhouette still samples inside the backdrop. Before, every sample past the room was pinned to its edge, which smeared one column of backdrop over a band of the surface with a hard boundary. With the whole margin on every side the map is byte-identical to before.
774
802
 
775
803
  ### Configurable Liquid Glass and liquid motion
776
804
 
package/README.md CHANGED
@@ -192,6 +192,7 @@ https://ui.jcsoftdev.com/docs/blocks/
192
192
  | `ElapsedTime` | `atoms` | Live `<time>` timer on one shared 1 s ticker: `since`, `serverOffsetMs`, `format`, `warnAt`, `dangerAt`, `countdownTo`; no `aria-live`. |
193
193
  | `TableGlyph` | `atoms` | SVG table with chairs placed from `shape` (`round`, `square`, `rect`, `bar`) and `seats`; `occupied`, `size`, `pattern`. |
194
194
  | `FloorPlan` | `containers` | Read-only salon plan on a grid-unit canvas: items as roving-focus buttons, landmarks, group outlines, `late`/`selected` rings. |
195
+ | `OrderTicket` | `containers` | Paper kitchen ticket: table or channel + number title, `ElapsedTime`, progress against `targetMinutes`, ok/warn/late state (late is a filled band), lines with `aria-pressed` toggles, `readOnly`, `part`/`parts` continuation; `orderTicketState` and `splitTicketLines` helpers. |
195
196
  | `Seal` | `atoms` | Stamp mark: `title`, `icon`, `tone`, optional named `label`. |
196
197
  | `Tooltip` | `overlays` | Hover and focus tip: `content`, `shortcut`, `side`, `openDelay`, `closeDelay`; `role="tooltip"`. |
197
198
  | `AlertDialog` | `overlays` | `role="alertdialog"` with cancel and confirm, `tone="danger"`, async `onConfirm` with a pending state. |
@@ -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";
@@ -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,2 @@
1
+ export { type OrderTicketLine, type OrderTicketLineStatus, type OrderTicketState, orderTicketState, splitTicketLines, ticketLineCost, warnLeadSeconds, } from "./model.js";
2
+ export { OrderTicket, type OrderTicketChannel, type OrderTicketPart, type OrderTicketProps, } from "./order-ticket.js";
@@ -0,0 +1,16 @@
1
+ import {
2
+ orderTicketState,
3
+ splitTicketLines,
4
+ ticketLineCost,
5
+ warnLeadSeconds
6
+ } from "./model.js";
7
+ import {
8
+ OrderTicket
9
+ } from "./order-ticket.js";
10
+ export {
11
+ OrderTicket,
12
+ orderTicketState,
13
+ splitTicketLines,
14
+ ticketLineCost,
15
+ warnLeadSeconds
16
+ };
@@ -0,0 +1,18 @@
1
+ export type OrderTicketState = "ok" | "warn" | "late";
2
+ export type OrderTicketLineStatus = "pending" | "in-progress" | "done";
3
+ export interface OrderTicketLine {
4
+ id: string;
5
+ qty: number;
6
+ name: string;
7
+ modifiers?: readonly string[] | undefined;
8
+ note?: string | undefined;
9
+ allergy?: string | undefined;
10
+ status?: OrderTicketLineStatus | undefined;
11
+ onToggle?: (() => void) | undefined;
12
+ }
13
+ export declare function warnLeadSeconds(targetMinutes: number): number;
14
+ export declare function orderTicketState(elapsedSeconds: number, targetMinutes: number): OrderTicketState;
15
+ type LineShape = Pick<OrderTicketLine, "modifiers" | "note" | "allergy">;
16
+ export declare function ticketLineCost(line: LineShape): number;
17
+ export declare function splitTicketLines<Line extends LineShape>(lines: readonly Line[], budget: number, cost?: (line: Line) => number): Line[][];
18
+ export {};
@@ -0,0 +1,36 @@
1
+ const MIN_WARN_LEAD_SECONDS = 120;
2
+ const WARN_LEAD_SHARE = 0.25;
3
+ function warnLeadSeconds(targetMinutes) {
4
+ return Math.max(MIN_WARN_LEAD_SECONDS, targetMinutes * 60 * WARN_LEAD_SHARE);
5
+ }
6
+ function orderTicketState(elapsedSeconds, targetMinutes) {
7
+ const target = targetMinutes * 60;
8
+ if (elapsedSeconds > target) return "late";
9
+ if (elapsedSeconds >= target - warnLeadSeconds(targetMinutes)) return "warn";
10
+ return "ok";
11
+ }
12
+ function ticketLineCost(line) {
13
+ return 1 + (line.modifiers?.length ? 0.6 : 0) + (line.note ? 0.9 : 0) + (line.allergy ? 0.9 : 0);
14
+ }
15
+ function splitTicketLines(lines, budget, cost = ticketLineCost) {
16
+ const parts = [];
17
+ let used = 0;
18
+ for (const line of lines) {
19
+ const weight = cost(line);
20
+ const current = parts.at(-1);
21
+ if (current && used + weight <= budget) {
22
+ current.push(line);
23
+ used += weight;
24
+ } else {
25
+ parts.push([line]);
26
+ used = weight;
27
+ }
28
+ }
29
+ return parts;
30
+ }
31
+ export {
32
+ orderTicketState,
33
+ splitTicketLines,
34
+ ticketLineCost,
35
+ warnLeadSeconds
36
+ };
@@ -0,0 +1,34 @@
1
+ import { type ComponentPropsWithoutRef, type ReactNode } from "react";
2
+ import type { ClassNames } from "../../utils/class-names.js";
3
+ import { type OrderTicketLine, type OrderTicketState } from "./model.js";
4
+ export type OrderTicketPart = "root" | "paper" | "band" | "title" | "meta" | "timer" | "progress" | "lines" | "line" | "footer";
5
+ export interface OrderTicketChannel {
6
+ label: string;
7
+ icon?: ReactNode;
8
+ }
9
+ export interface OrderTicketProps extends Omit<ComponentPropsWithoutRef<"article">, "title" | "children"> {
10
+ table?: string | undefined;
11
+ number?: string | number | undefined;
12
+ channel?: OrderTicketChannel | undefined;
13
+ guests?: number | undefined;
14
+ server?: string | undefined;
15
+ customer?: string | undefined;
16
+ since: Date | string;
17
+ targetMinutes: number;
18
+ serverOffsetMs?: number | undefined;
19
+ state?: OrderTicketState | undefined;
20
+ lines: readonly OrderTicketLine[];
21
+ partIndex?: number | undefined;
22
+ partCount?: number | undefined;
23
+ recovered?: boolean | undefined;
24
+ chip?: ReactNode;
25
+ readOnly?: boolean | undefined;
26
+ onStartAll?: ((lines: readonly OrderTicketLine[]) => void) | undefined;
27
+ onReadyAll?: ((lines: readonly OrderTicketLine[]) => void) | undefined;
28
+ actions?: ReactNode;
29
+ hanging?: boolean | undefined;
30
+ headingLevel?: 2 | 3 | 4 | undefined;
31
+ viewTransitionName?: string | undefined;
32
+ classNames?: ClassNames<OrderTicketPart> | undefined;
33
+ }
34
+ export declare function OrderTicket({ table, number, channel, guests, server, customer, since, targetMinutes, serverOffsetMs, state: stateProp, lines, partIndex, partCount, recovered, chip, readOnly, onStartAll, onReadyAll, actions, hanging, headingLevel, viewTransitionName, classNames, className, style, ...props }: OrderTicketProps): import("react").JSX.Element;
@@ -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, and the offsets are clamped so no sample lands beyond it.
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
  }