@stll/ui 0.80.0 → 0.81.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.
@@ -71,7 +71,9 @@ type DayCalendarColumnHeader = {
71
71
  };
72
72
  /**
73
73
  * A `locked` column has no blocks field, so caller data cannot reach it: it
74
- * paints synthetic placeholder bars behind the caller's `action`.
74
+ * paints synthetic placeholder bars behind the caller's `action`. A `pending`
75
+ * column's blocks are not known yet: it shimmers where the caller already
76
+ * knows something was recorded, and takes no selection meanwhile.
75
77
  */
76
78
  export type DayCalendarColumn = (DayCalendarColumnHeader & {
77
79
  blocks: readonly DayCalendarBlock[];
@@ -80,6 +82,9 @@ export type DayCalendarColumn = (DayCalendarColumnHeader & {
80
82
  }) | (DayCalendarColumnHeader & {
81
83
  action: ReactNode;
82
84
  type: "locked";
85
+ }) | (DayCalendarColumnHeader & {
86
+ placeholders: readonly DayCalendarRange[];
87
+ type: "pending";
83
88
  });
84
89
  /**
85
90
  * The committed range the caller is acting on. `panel` anchors caller content
@@ -1,4 +1,5 @@
1
1
  import { Popover, PopoverContent as PopoverPopup, PopoverTrigger } from "../components/popover.js";
2
+ import { Skeleton } from "../components/skeleton.js";
2
3
  import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "../components/tooltip.js";
3
4
  import { TruncatedText } from "../components/truncated-text.js";
4
5
  import { resolveMatterColor } from "../lib/matter-colors.js";
@@ -16,10 +17,14 @@ const isSameDraftView = (left, right) => left.date === right.date && left.endHou
16
17
  * change, committing it would select a stale range, so it is discarded.
17
18
  */
18
19
  const useDraftSelection = (view) => {
20
+ const viewKey = `${view.date}:${view.startHour}:${view.endHour}:${view.granularity}:${view.timeZone}`;
21
+ const [prevViewKey, setPrevViewKey] = useState(viewKey);
19
22
  const [stored, setDraft] = useState(null);
20
- const draft = stored !== null && isSameDraftView(stored.view, view) ? stored : null;
21
- if (stored !== null && draft === null) setDraft(null);
22
- return [draft, setDraft];
23
+ if (prevViewKey !== viewKey) {
24
+ setPrevViewKey(viewKey);
25
+ setDraft(null);
26
+ }
27
+ return [stored !== null && isSameDraftView(stored.view, view) ? stored : null, setDraft];
23
28
  };
24
29
  const GUTTER_WIDTH = "4rem";
25
30
  /**
@@ -187,16 +192,9 @@ const DayCalendar = ({ ariaLabel, columns, date, granularity, hours, locale, now
187
192
  "aria-hidden": "true",
188
193
  className: "bg-card border-border sticky top-0 z-30 rounded-ss-xl border-b"
189
194
  }),
190
- columns.map((column, index) => /* @__PURE__ */ jsxs("header", {
191
- className: cn("bg-card border-border text-muted-foreground sticky top-0 z-30 flex min-w-0 items-center gap-2 border-s border-b px-3 py-2.5 text-xs font-medium", index === columns.length - 1 && "rounded-se-xl"),
192
- "data-slot": "day-calendar-column-header",
193
- children: [/* @__PURE__ */ jsx(TruncatedText, {
194
- className: "shrink-0",
195
- children: column.label
196
- }), column.badge === void 0 ? null : /* @__PURE__ */ jsx(TruncatedText, {
197
- className: "bg-muted text-muted-foreground text-2xs rounded-full px-2 py-0.5",
198
- children: column.badge
199
- })]
195
+ columns.map((column, index) => /* @__PURE__ */ jsx(ColumnHeader, {
196
+ column,
197
+ last: index === columns.length - 1
200
198
  }, column.id)),
201
199
  /* @__PURE__ */ jsx("div", {
202
200
  "aria-hidden": "true",
@@ -224,6 +222,11 @@ const DayCalendar = ({ ariaLabel, columns, date, granularity, hours, locale, now
224
222
  style: bodyStyle,
225
223
  children: [
226
224
  column.type === "locked" ? /* @__PURE__ */ jsx(LockedColumnBody, { action: column.action }) : null,
225
+ column.type === "pending" ? /* @__PURE__ */ jsx(PendingColumnBody, {
226
+ grid,
227
+ placeholders: column.placeholders,
228
+ slotLinesStyle
229
+ }) : null,
227
230
  column.type === "blocks" && column.rangeSelection.type === "enabled" ? /* @__PURE__ */ jsxs("div", {
228
231
  "aria-keyshortcuts": "ArrowUp ArrowDown Shift+ArrowUp Shift+ArrowDown Enter Escape",
229
232
  "aria-label": column.rangeSelection.label,
@@ -266,7 +269,7 @@ const DayCalendar = ({ ariaLabel, columns, date, granularity, hours, locale, now
266
269
  timeFormatFor
267
270
  })]
268
271
  }) : null,
269
- nowVisible && column.type === "blocks" ? /* @__PURE__ */ jsx("div", {
272
+ nowVisible && column.type !== "locked" ? /* @__PURE__ */ jsx("div", {
270
273
  "aria-hidden": "true",
271
274
  className: "bg-destructive pointer-events-none absolute inset-x-0 z-20 h-0.5",
272
275
  "data-slot": "day-calendar-now",
@@ -284,6 +287,17 @@ const DayCalendar = ({ ariaLabel, columns, date, granularity, hours, locale, now
284
287
  ]
285
288
  });
286
289
  };
290
+ const ColumnHeader = ({ column, last }) => /* @__PURE__ */ jsxs("header", {
291
+ className: cn("bg-card border-border text-muted-foreground sticky top-0 z-30 flex min-w-0 items-center gap-2 border-s border-b px-3 py-2.5 text-xs font-medium", last && "rounded-se-xl"),
292
+ "data-slot": "day-calendar-column-header",
293
+ children: [/* @__PURE__ */ jsx(TruncatedText, {
294
+ className: "shrink-0",
295
+ children: column.label
296
+ }), column.badge === void 0 ? null : /* @__PURE__ */ jsx(TruncatedText, {
297
+ className: "bg-muted text-muted-foreground text-2xs rounded-full px-2 py-0.5",
298
+ children: column.badge
299
+ })]
300
+ });
287
301
  const ColumnBlocks = ({ blocks, grid }) => {
288
302
  const visible = blocks.flatMap((block) => {
289
303
  const startMs = Math.max(block.startMs, grid.bounds.startMs);
@@ -329,9 +343,17 @@ const ENTRY_STATE_CLASSES = {
329
343
  final: "",
330
344
  suggestion: "border border-dashed border-current/45 outline-none hover:ring-1 hover:ring-ring/50 focus-visible:ring-2 focus-visible:ring-ring"
331
345
  };
332
- const DayCalendarBlockView = ({ block, grid, lane, range }) => {
346
+ /** Where a block of `range` is drawn: at least {@link BLOCK_MIN_PX} tall,
347
+ * unless the grid ends sooner. */
348
+ const blockExtent = (range, grid) => {
333
349
  const top = timeToOffset(range.startMs, grid);
334
- const blockSize = Math.min(Math.max(timeToOffset(range.endMs, grid) - top, BLOCK_MIN_PX), boundsHeight(grid) - top);
350
+ return {
351
+ blockSize: Math.min(Math.max(timeToOffset(range.endMs, grid) - top, BLOCK_MIN_PX), boundsHeight(grid) - top),
352
+ top
353
+ };
354
+ };
355
+ const DayCalendarBlockView = ({ block, grid, lane, range }) => {
356
+ const { blockSize, top } = blockExtent(range, grid);
335
357
  const placement = {
336
358
  blockSize,
337
359
  inlineSize: `${String(100 / lane.laneCount)}%`,
@@ -340,15 +362,22 @@ const DayCalendarBlockView = ({ block, grid, lane, range }) => {
340
362
  };
341
363
  const oneLine = blockSize < TWO_LINE_BLOCK_MIN_PX;
342
364
  const className = cn("text-foreground @container flex h-full w-full min-w-0 overflow-hidden rounded-md px-2.5 text-start text-xs", oneLine ? "flex-row items-center gap-2" : "flex-col gap-0.5 py-1", BLOCK_KIND_CLASSES[block.kind], block.kind === "entry" && ENTRY_STATE_CLASSES[block.state], block.tone.type === "matter" && "border-s-[3px]", block.tone.type === "neutral" && "bg-muted");
343
- const content = blockSize < 16 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TruncatedText, {
365
+ const title = /* @__PURE__ */ jsx(TruncatedText, {
344
366
  className: cn("font-medium", oneLine ? "shrink" : "shrink-0"),
345
367
  hint: false,
346
368
  children: block.title
347
- }), block.caption === void 0 ? null : /* @__PURE__ */ jsx(TruncatedText, {
348
- className: cn("text-muted-foreground tabular-nums", oneLine && "shrink-[999]"),
369
+ });
370
+ const caption = block.caption === void 0 ? null : /* @__PURE__ */ jsx(TruncatedText, {
371
+ className: "text-muted-foreground tabular-nums",
349
372
  hint: false,
350
373
  children: block.caption
351
- })] });
374
+ });
375
+ let content = null;
376
+ if (blockSize >= 16) content = oneLine ? /* @__PURE__ */ jsxs("div", {
377
+ className: "flex h-[1lh] min-w-0 flex-1 flex-wrap items-center gap-x-2 overflow-hidden",
378
+ "data-slot": "day-calendar-block-line",
379
+ children: [title, caption]
380
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [title, caption] });
352
381
  const shared = {
353
382
  "aria-label": block.accessibleLabel,
354
383
  className,
@@ -538,6 +567,34 @@ const LOCKED_BAR_TONES = {
538
567
  neutral: "bg-muted-foreground/15",
539
568
  tinted: "bg-muted-foreground/25"
540
569
  };
570
+ /** Shimmers at each range the caller knows something was recorded in, placed
571
+ * as a block there would be, until the column's blocks are known. */
572
+ const PendingColumnBody = ({ grid, placeholders, slotLinesStyle }) => /* @__PURE__ */ jsx("div", {
573
+ "aria-busy": "true",
574
+ className: "absolute inset-0",
575
+ "data-slot": "day-calendar-surface",
576
+ style: slotLinesStyle,
577
+ children: placeholders.flatMap((placeholder) => {
578
+ const startMs = Math.max(placeholder.startMs, grid.bounds.startMs);
579
+ const endMs = Math.min(placeholder.endMs, grid.bounds.endMs);
580
+ if (endMs <= startMs) return [];
581
+ const { blockSize, top } = blockExtent({
582
+ endMs,
583
+ startMs
584
+ }, grid);
585
+ return [/* @__PURE__ */ jsx("div", {
586
+ className: "absolute inset-x-0 px-1.5 py-px",
587
+ style: {
588
+ blockSize,
589
+ insetBlockStart: top
590
+ },
591
+ children: /* @__PURE__ */ jsx(Skeleton, {
592
+ className: "h-full rounded-md",
593
+ "data-slot": "day-calendar-pending-block"
594
+ })
595
+ }, startMs)];
596
+ })
597
+ });
541
598
  const LockedColumnBody = ({ action }) => /* @__PURE__ */ jsxs("div", {
542
599
  className: "absolute inset-0 overflow-hidden",
543
600
  children: [/* @__PURE__ */ jsx("div", {
@@ -29,19 +29,19 @@ const toGlyphs = (value, previous, generation) => {
29
29
  * still: a count that loads does not announce itself.
30
30
  */
31
31
  const AnimatedCount = ({ className, value }) => {
32
+ const [prevValue, setPrevValue] = useState(value);
32
33
  const [state, setState] = useState(() => ({
33
34
  generation: 0,
34
- glyphs: toGlyphs(value, null, 0),
35
- value
35
+ glyphs: toGlyphs(value, null, 0)
36
36
  }));
37
37
  let { glyphs } = state;
38
- if (state.value !== value) {
38
+ if (prevValue !== value) {
39
39
  const generation = state.generation + 1;
40
40
  glyphs = toGlyphs(value, state.glyphs, generation);
41
+ setPrevValue(value);
41
42
  setState({
42
43
  generation,
43
- glyphs,
44
- value
44
+ glyphs
45
45
  });
46
46
  }
47
47
  return /* @__PURE__ */ jsxs("span", {
@@ -18,131 +18,20 @@ export type DocumentMarkArtwork = {
18
18
  /** A paint reference to one of the mark's gradients. */
19
19
  export declare const GRADIENT_REFERENCE: RegExp;
20
20
  export declare const DOCUMENT_MARKS: {
21
- readonly ofd: {
22
- viewBox: string;
23
- gradients: never[];
24
- shapes: ({
25
- tag: "path";
26
- attrs: {
27
- d: string;
28
- fill: string;
29
- stroke?: never;
30
- strokeWidth?: never;
31
- strokeLinecap?: never;
32
- strokeLinejoin?: never;
33
- };
34
- } | {
35
- tag: "path";
36
- attrs: {
37
- d: string;
38
- fill: string;
39
- stroke: string;
40
- strokeWidth: string;
41
- strokeLinecap: string;
42
- strokeLinejoin: string;
43
- };
44
- })[];
45
- };
46
- readonly uyap: {
47
- viewBox: string;
48
- gradients: never[];
49
- shapes: ({
50
- tag: "path";
51
- attrs: {
52
- d: string;
53
- fill: string;
54
- stroke?: never;
55
- strokeWidth?: never;
56
- strokeLinecap?: never;
57
- strokeLinejoin?: never;
58
- };
59
- } | {
60
- tag: "path";
61
- attrs: {
62
- d: string;
63
- fill: string;
64
- stroke: string;
65
- strokeWidth: string;
66
- strokeLinecap: string;
67
- strokeLinejoin: string;
68
- };
69
- })[];
70
- };
71
- readonly asicE: {
72
- viewBox: string;
73
- gradients: never[];
74
- shapes: ({
75
- tag: "path";
76
- attrs: {
77
- d: string;
78
- fill: string;
79
- stroke?: never;
80
- strokeWidth?: never;
81
- strokeLinecap?: never;
82
- strokeLinejoin?: never;
83
- };
84
- } | {
85
- tag: "path";
86
- attrs: {
87
- d: string;
88
- fill: string;
89
- stroke: string;
90
- strokeWidth: string;
91
- strokeLinecap: string;
92
- strokeLinejoin: string;
93
- };
94
- })[];
95
- };
96
- readonly asicS: {
97
- viewBox: string;
98
- gradients: never[];
99
- shapes: ({
100
- tag: "path";
101
- attrs: {
102
- d: string;
103
- fill: string;
104
- stroke?: never;
105
- strokeWidth?: never;
106
- strokeLinecap?: never;
107
- strokeLinejoin?: never;
108
- };
109
- } | {
110
- tag: "path";
111
- attrs: {
112
- d: string;
113
- fill: string;
114
- stroke: string;
115
- strokeWidth: string;
116
- strokeLinecap: string;
117
- strokeLinejoin: string;
118
- };
119
- })[];
120
- };
121
- readonly cades: {
122
- viewBox: string;
123
- gradients: never[];
124
- shapes: ({
125
- tag: "path";
126
- attrs: {
127
- d: string;
128
- fill: string;
129
- stroke?: never;
130
- strokeWidth?: never;
131
- strokeLinecap?: never;
132
- strokeLinejoin?: never;
133
- };
134
- } | {
135
- tag: "path";
136
- attrs: {
137
- d: string;
138
- fill: string;
139
- stroke: string;
140
- strokeWidth: string;
141
- strokeLinecap: string;
142
- strokeLinejoin: string;
143
- };
144
- })[];
145
- };
21
+ readonly ofd: DocumentMarkArtwork;
22
+ readonly uyap: DocumentMarkArtwork;
23
+ readonly asicE: DocumentMarkArtwork;
24
+ readonly asicS: DocumentMarkArtwork;
25
+ readonly bdoc: DocumentMarkArtwork;
26
+ readonly cades: DocumentMarkArtwork;
27
+ readonly fatturaPA: DocumentMarkArtwork;
28
+ readonly isdoc: DocumentMarkArtwork;
29
+ readonly isdocx: DocumentMarkArtwork;
30
+ readonly xml: DocumentMarkArtwork;
31
+ readonly eAkta: DocumentMarkArtwork;
32
+ readonly et3: DocumentMarkArtwork;
33
+ readonly zep: DocumentMarkArtwork;
34
+ readonly xadesZep: DocumentMarkArtwork;
146
35
  readonly dataBox: {
147
36
  readonly viewBox: "0 0 24 24";
148
37
  readonly gradients: readonly [];
@@ -336,45 +336,230 @@ const openDocumentMark = ({ badge, letter, arrows, layers }) => {
336
336
  ]
337
337
  };
338
338
  };
339
- const legalDocumentMark = (details) => ({
340
- viewBox: "0 0 24 24",
341
- gradients: [],
342
- shapes: [
343
- {
344
- tag: "path",
345
- attrs: {
346
- d: "M5 1h9l5 5v15a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2z",
347
- fill: "#566275"
348
- }
349
- },
350
- {
351
- tag: "path",
352
- attrs: {
353
- d: "M14 1v5h5",
354
- fill: "#c2c9d2"
355
- }
356
- },
357
- {
358
- tag: "path",
359
- attrs: {
360
- d: details,
361
- fill: "none",
362
- stroke: "#fff",
363
- strokeWidth: "1.4",
364
- strokeLinecap: "round",
365
- strokeLinejoin: "round"
339
+ /**
340
+ * The letters a tag is drawn with, as strokes in a box three wide and four
341
+ * tall (the data-box mark's letters): points "x y" joined by commas, strokes
342
+ * by "|". A stroke that ends where it starts is closed.
343
+ */
344
+ const MARK_GLYPHS = {
345
+ A: "0 4,0 1.5,1.5 0,3 1.5,3 4|0 2.5,3 2.5",
346
+ B: "0 2,2.2 2,3 1.3,3 0.7,2.2 0,0 0,0 4,2.2 4,3 3.3,3 2.7,2.2 2",
347
+ C: "3 0,0 0,0 4,3 4",
348
+ D: "0 0,2 0,3 1,3 3,2 4,0 4,0 0",
349
+ E: "3 0,0 0,0 4,3 4|0 2,2.2 2",
350
+ F: "3 0,0 0,0 4|0 2,2.2 2",
351
+ I: "0.5 0,2.5 0|1.5 0,1.5 4|0.5 4,2.5 4",
352
+ L: "0 0,0 4,3 4",
353
+ M: "0 4,0 0,1.5 2,3 0,3 4",
354
+ O: "0 0,3 0,3 4,0 4,0 0",
355
+ P: "0 4,0 0,3 0,3 2,0 2",
356
+ S: "3 0,0 0,0 2,3 2,3 4,0 4",
357
+ T: "0 0,3 0|1.5 0,1.5 4",
358
+ U: "0 0,0 4,3 4,3 0",
359
+ X: "0 0,3 4|3 0,0 4",
360
+ Z: "0 0,3 0,0 4,3 4",
361
+ "3": "0 0,3 0,1.5 2,3 2,3 4,0 4",
362
+ "7": "0 0,3 0,1 4"
363
+ };
364
+ const GLYPH_WIDTH = 3;
365
+ const GLYPH_HEIGHT = 4;
366
+ const GLYPH_GAP = 2;
367
+ /** The page's room for its widest line, clear of the page's edges. */
368
+ const TAG_MAX_WIDTH = 14;
369
+ const TAG_MAX_SCALE = 1.15;
370
+ const TAG_LINE_GAP = 2;
371
+ const TAG_CENTER_X = 11;
372
+ /** The middle of the page below its fold. */
373
+ const TAG_CENTER_Y = 15;
374
+ const TAG_STROKE_WIDTH = 1.2;
375
+ const coordinate = (value) => String(Math.round(value * 100) / 100);
376
+ const lineWidth = (line) => line.length * GLYPH_WIDTH + (line.length - 1) * GLYPH_GAP;
377
+ const glyphStrokes = (glyph) => MARK_GLYPHS[glyph].split("|").map((stroke) => stroke.split(",").map((point) => {
378
+ const [x = 0, y = 0] = point.split(" ").map(Number);
379
+ return {
380
+ x,
381
+ y
382
+ };
383
+ }));
384
+ /** One stroke path for every letter of the tag, centred on the page. */
385
+ const tagPath = (lines) => {
386
+ const scale = Math.min(TAG_MAX_SCALE, TAG_MAX_WIDTH / Math.max(...lines.map(lineWidth)));
387
+ const lineHeight = GLYPH_HEIGHT * scale;
388
+ const blockHeight = lines.length * lineHeight + (lines.length - 1) * TAG_LINE_GAP;
389
+ const top = TAG_CENTER_Y - blockHeight / 2;
390
+ return {
391
+ d: lines.flatMap((line, lineIndex) => {
392
+ const left = TAG_CENTER_X - lineWidth(line) * scale / 2;
393
+ const y0 = top + lineIndex * (lineHeight + TAG_LINE_GAP);
394
+ return line.flatMap((glyph, glyphIndex) => {
395
+ const x0 = left + glyphIndex * 5 * scale;
396
+ return glyphStrokes(glyph).map((points) => {
397
+ const first = points.at(0);
398
+ const last = points.at(-1);
399
+ const closed = points.length > 2 && first?.x === last?.x && first?.y === last?.y;
400
+ return `M${(closed ? points.slice(0, -1) : points).map(({ x, y }) => `${coordinate(x0 + x * scale)} ${coordinate(y0 + y * scale)}`).join("L")}${closed ? "Z" : ""}`;
401
+ });
402
+ });
403
+ }).join(""),
404
+ strokeWidth: coordinate(TAG_STROKE_WIDTH * Math.min(1, scale))
405
+ };
406
+ };
407
+ const legalFormatMark = ({ color, lines }) => {
408
+ const tag = tagPath(lines);
409
+ return {
410
+ viewBox: "0 0 24 24",
411
+ gradients: [],
412
+ shapes: [
413
+ {
414
+ tag: "path",
415
+ attrs: {
416
+ d: "M5 1h9l5 5v15a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2z",
417
+ fill: color
418
+ }
419
+ },
420
+ {
421
+ tag: "path",
422
+ attrs: {
423
+ d: "M14 1v5h5",
424
+ fill: "#fff",
425
+ fillOpacity: "0.5"
426
+ }
427
+ },
428
+ {
429
+ tag: "path",
430
+ attrs: {
431
+ d: tag.d,
432
+ fill: "none",
433
+ stroke: "#fff",
434
+ strokeLinecap: "round",
435
+ strokeLinejoin: "round",
436
+ strokeWidth: tag.strokeWidth
437
+ }
366
438
  }
367
- }
368
- ]
369
- });
370
- const signedDocumentMark = legalDocumentMark("M7 11h8m-8 3h5m1 4 2 2 4-5");
371
- const structuredDocumentMark = legalDocumentMark("M7 11h8m-8 4h8m-8 4h5");
439
+ ]
440
+ };
441
+ };
372
442
  const DOCUMENT_MARKS = {
373
- ofd: structuredDocumentMark,
374
- uyap: structuredDocumentMark,
375
- asicE: signedDocumentMark,
376
- asicS: signedDocumentMark,
377
- cades: signedDocumentMark,
443
+ ofd: legalFormatMark({
444
+ color: "#9a5b00",
445
+ lines: [[
446
+ "O",
447
+ "F",
448
+ "D"
449
+ ]]
450
+ }),
451
+ uyap: legalFormatMark({
452
+ color: "#b3261e",
453
+ lines: [[
454
+ "U",
455
+ "D",
456
+ "F"
457
+ ]]
458
+ }),
459
+ asicE: legalFormatMark({
460
+ color: "#2e6b4f",
461
+ lines: [[
462
+ "A",
463
+ "S",
464
+ "I",
465
+ "C"
466
+ ], ["E"]]
467
+ }),
468
+ asicS: legalFormatMark({
469
+ color: "#4f7a2e",
470
+ lines: [[
471
+ "A",
472
+ "S",
473
+ "I",
474
+ "C"
475
+ ], ["S"]]
476
+ }),
477
+ bdoc: legalFormatMark({
478
+ color: "#0f6e7a",
479
+ lines: [[
480
+ "B",
481
+ "D",
482
+ "O",
483
+ "C"
484
+ ]]
485
+ }),
486
+ cades: legalFormatMark({
487
+ color: "#6b4c9a",
488
+ lines: [[
489
+ "P",
490
+ "7",
491
+ "M"
492
+ ]]
493
+ }),
494
+ fatturaPA: legalFormatMark({
495
+ color: "#1d6f42",
496
+ lines: [[
497
+ "F",
498
+ "P",
499
+ "A"
500
+ ]]
501
+ }),
502
+ isdoc: legalFormatMark({
503
+ color: "#1f5fa8",
504
+ lines: [[
505
+ "I",
506
+ "S",
507
+ "D",
508
+ "O",
509
+ "C"
510
+ ]]
511
+ }),
512
+ isdocx: legalFormatMark({
513
+ color: "#2a4f8f",
514
+ lines: [[
515
+ "I",
516
+ "S",
517
+ "D",
518
+ "O",
519
+ "C"
520
+ ], ["X"]]
521
+ }),
522
+ xml: legalFormatMark({
523
+ color: "#5c6470",
524
+ lines: [[
525
+ "X",
526
+ "M",
527
+ "L"
528
+ ]]
529
+ }),
530
+ eAkta: legalFormatMark({
531
+ color: "#8c2f5d",
532
+ lines: [[
533
+ "E",
534
+ "S",
535
+ "3"
536
+ ]]
537
+ }),
538
+ et3: legalFormatMark({
539
+ color: "#a2481f",
540
+ lines: [[
541
+ "E",
542
+ "T",
543
+ "3"
544
+ ]]
545
+ }),
546
+ zep: legalFormatMark({
547
+ color: "#24529c",
548
+ lines: [[
549
+ "Z",
550
+ "E",
551
+ "P"
552
+ ]]
553
+ }),
554
+ xadesZep: legalFormatMark({
555
+ color: "#3d4f8f",
556
+ lines: [[
557
+ "X",
558
+ "Z",
559
+ "E",
560
+ "P"
561
+ ]]
562
+ }),
378
563
  dataBox: {
379
564
  viewBox: "0 0 24 24",
380
565
  gradients: [],
@@ -143,23 +143,22 @@ const useEventCallback = (handler) => {
143
143
  };
144
144
  const useColorManipulation = (color, onChange) => {
145
145
  const onChangeCallback = useEventCallback(onChange);
146
- const [hsva, setHsva] = useState(() => hexToHsva(color));
147
- const [committedColor, setCommittedColor] = useState(color);
148
- if (!equalHex(color, committedColor)) {
149
- setCommittedColor(color);
150
- setHsva(hexToHsva(color));
151
- }
146
+ const [local, setLocal] = useState(() => ({
147
+ color,
148
+ hsva: hexToHsva(color)
149
+ }));
150
+ const hsva = equalHex(color, local.color) ? local.hsva : hexToHsva(color);
152
151
  const handleChange = (params) => {
153
152
  const next = {
154
153
  ...hsva,
155
154
  ...params
156
155
  };
157
- setHsva(next);
158
156
  const hex = hsvaToHex(next);
159
- if (!equalHex(hex, committedColor)) {
160
- setCommittedColor(hex);
161
- onChangeCallback(hex);
162
- }
157
+ setLocal({
158
+ color: hex,
159
+ hsva: next
160
+ });
161
+ if (!equalHex(hex, color)) onChangeCallback(hex);
163
162
  };
164
163
  return [hsva, handleChange];
165
164
  };
@@ -11,16 +11,18 @@ import { useState } from "react";
11
11
  * under reduced motion the label simply changes.
12
12
  */
13
13
  const SwapText = ({ className, text }) => {
14
+ const [prevText, setPrevText] = useState(text);
14
15
  const [state, setState] = useState({
15
- current: text,
16
16
  generation: 0,
17
17
  previous: null
18
18
  });
19
- if (state.current !== text) setState({
20
- current: text,
21
- generation: state.generation + 1,
22
- previous: state.current
23
- });
19
+ if (prevText !== text) {
20
+ setPrevText(text);
21
+ setState({
22
+ generation: state.generation + 1,
23
+ previous: prevText
24
+ });
25
+ }
24
26
  const hasSwapped = state.generation > 0;
25
27
  return /* @__PURE__ */ jsxs("span", {
26
28
  className: "inline-grid",
@@ -43,7 +45,7 @@ const SwapText = ({ className, text }) => {
43
45
  className: cn("col-start-1 row-start-1", hasSwapped && "motion-safe:animate-swap-in"),
44
46
  children: /* @__PURE__ */ jsx("span", {
45
47
  className,
46
- children: state.current
48
+ children: text
47
49
  })
48
50
  }, `in-${state.generation}`)]
49
51
  });