@jfrader/ui 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/dist/accordion-DLul6vIl.js +205 -0
  2. package/dist/accordion.js +1 -1
  3. package/dist/{announcement-bar-B58xempt.js → announcement-bar-Dlbq5-9D.js} +1 -1
  4. package/dist/announcement-bar.js +1 -1
  5. package/dist/avatar-CaGJHy1N.js +145 -0
  6. package/dist/{avatar-group-DOQQuV51.js → avatar-group-M1opAQEG.js} +1 -1
  7. package/dist/avatar-group.js +1 -1
  8. package/dist/avatar.js +1 -1
  9. package/dist/badge-CjM5Agqk.js +119 -0
  10. package/dist/badge.js +1 -1
  11. package/dist/{bottom-sheet-DPJBFkie.js → bottom-sheet-DjZOPq4k.js} +10 -9
  12. package/dist/bottom-sheet.js +1 -1
  13. package/dist/{breadcrumbs-Cfw_hgt2.js → breadcrumbs-BDK_LiwH.js} +10 -3
  14. package/dist/breadcrumbs.js +1 -1
  15. package/dist/{button-C92uYFJW.js → button-NLY0h6EJ.js} +7 -7
  16. package/dist/button.js +1 -1
  17. package/dist/{calendar-B3Svu0X2.js → calendar-BzJdv_SZ.js} +3 -1
  18. package/dist/calendar.js +1 -1
  19. package/dist/card-Ca4KQKYQ.js +154 -0
  20. package/dist/card.js +1 -1
  21. package/dist/carousel-B7OrvD6J.js +474 -0
  22. package/dist/carousel.js +1 -1
  23. package/dist/{checkbox-cFquiSdy.js → checkbox-DKSzExj2.js} +16 -15
  24. package/dist/checkbox.js +1 -1
  25. package/dist/{chip-group-DTQd_M-G.js → chip-group-DjQ0_6Y9.js} +2 -1
  26. package/dist/chip-group.js +1 -1
  27. package/dist/{code-block-ahnRi-g8.js → code-block-B5we2lZa.js} +75 -74
  28. package/dist/code-block.js +1 -1
  29. package/dist/{combobox-Bhzvu9ma.js → combobox-DFFqOBCi.js} +114 -109
  30. package/dist/combobox.js +1 -1
  31. package/dist/command-palette-BmQu2w4H.js +391 -0
  32. package/dist/command-palette.js +1 -1
  33. package/dist/comment-thread-ASaXDcGo.js +1410 -0
  34. package/dist/comment-thread.js +2 -0
  35. package/dist/context-menu-__1c2Dk9.js +370 -0
  36. package/dist/context-menu.js +2 -0
  37. package/dist/{copy-button-ByiA6D3R.js → copy-button-DCSLcYS-.js} +1 -1
  38. package/dist/copy-button.js +1 -1
  39. package/dist/{date-picker-5zKSSuFF.js → date-picker-BiPN7yeK.js} +4 -4
  40. package/dist/date-picker.js +1 -1
  41. package/dist/date-range-picker-DQpUeKqV.js +570 -0
  42. package/dist/date-range-picker.js +1 -1
  43. package/dist/{dialog-ciiv9H2b.js → dialog-BX1zYMs-.js} +2 -1
  44. package/dist/dialog.js +1 -1
  45. package/dist/{divider-DYoJf0I_.js → divider-Cp7aNbhM.js} +21 -20
  46. package/dist/divider.js +1 -1
  47. package/dist/elastic-slider-BG6K019r.js +395 -0
  48. package/dist/elastic-slider.js +2 -0
  49. package/dist/{expandable-card-C-qJcZ14.js → expandable-card-rUATve0o.js} +8 -1
  50. package/dist/expandable-card.js +1 -1
  51. package/dist/expanding-search-BxOwtdwt.js +238 -0
  52. package/dist/expanding-search.js +2 -0
  53. package/dist/file-dropzone-BuXm3Tea.js +457 -0
  54. package/dist/file-dropzone.js +1 -1
  55. package/dist/{filter-toolbar-D5KEKTSe.js → filter-toolbar-Cy5Hqur-.js} +4 -2
  56. package/dist/filter-toolbar.js +1 -1
  57. package/dist/{hover-card-B-nrCIy2.js → hover-card-CoMJKg1g.js} +7 -7
  58. package/dist/hover-card.js +1 -1
  59. package/dist/{image-compare-ciuhPtQZ.js → image-compare-BxY8Ykzt.js} +1 -1
  60. package/dist/image-compare.js +1 -1
  61. package/dist/index.js +81 -76
  62. package/dist/{json-viewer-BcySQfjZ.js → json-viewer-DgWqyU75.js} +7 -3
  63. package/dist/json-viewer.js +1 -1
  64. package/dist/mention-input-sq61si9L.js +600 -0
  65. package/dist/mention-input.js +1 -1
  66. package/dist/menu-DDKgmK2F.js +295 -0
  67. package/dist/menu.js +1 -1
  68. package/dist/{metric-card-Bh9K4fZs.js → metric-card--lVTz5Wn.js} +2 -2
  69. package/dist/metric-card.js +1 -1
  70. package/dist/{multi-select-Pce_IYnz.js → multi-select-DG1BCFX7.js} +14 -6
  71. package/dist/multi-select.js +1 -1
  72. package/dist/{navigation-sP5fiuQS.js → navigation-CC26JDr-.js} +20 -14
  73. package/dist/navigation.js +1 -1
  74. package/dist/{overlay-layer-SeUyyEPD.js → overlay-layer-qEbpEtb8.js} +16 -2
  75. package/dist/{pagination-DmXZ8E85.js → pagination-BfkeWbmP.js} +23 -22
  76. package/dist/pagination.js +1 -1
  77. package/dist/pill-BaS-uIbn.js +58 -0
  78. package/dist/pill.js +1 -1
  79. package/dist/popover-CErIw2q3.js +125 -0
  80. package/dist/popover.js +1 -1
  81. package/dist/{progress-CbOWBUdA.js → progress-DAQkfhPd.js} +1 -1
  82. package/dist/progress.js +1 -1
  83. package/dist/{radio-cards-D2QZENI_.js → radio-cards-Cu9cBssN.js} +35 -34
  84. package/dist/radio-cards.js +1 -1
  85. package/dist/{radio-group-E6mMRgo7.js → radio-group-TIK0-iPX.js} +18 -15
  86. package/dist/radio-group.js +1 -1
  87. package/dist/{resizable-panels-BhjUVXZZ.js → resizable-panels-DUpQEpwG.js} +3 -2
  88. package/dist/resizable-panels.js +1 -1
  89. package/dist/{search-field-IxF0IJXm.js → search-field-DMvho0KQ.js} +2 -2
  90. package/dist/search-field.js +1 -1
  91. package/dist/{segmented-control-yO1K1nbi.js → segmented-control-8ZUGnsZm.js} +2 -1
  92. package/dist/segmented-control.js +1 -1
  93. package/dist/{select-n_H52W1Z.js → select-D5rhJ8gi.js} +3 -2
  94. package/dist/select.js +1 -1
  95. package/dist/{signature-pad-q2SAsrdD.js → signature-pad-_bTeguN9.js} +256 -251
  96. package/dist/signature-pad.js +1 -1
  97. package/dist/slider-DVG6-Awh.js +308 -0
  98. package/dist/slider.js +1 -1
  99. package/dist/{sortable-data-table-tirqlLY2.js → sortable-data-table-CYKT_Ng7.js} +2 -2
  100. package/dist/sortable-data-table.js +1 -1
  101. package/dist/{split-button-Cb3EHs64.js → split-button-BCw4zZom.js} +75 -81
  102. package/dist/split-button.js +1 -1
  103. package/dist/{swipe-actions-DiZC57-3.js → swipe-actions-CBuJREU1.js} +4 -2
  104. package/dist/swipe-actions.js +1 -1
  105. package/dist/switch-C1WrKrf-.js +145 -0
  106. package/dist/switch.js +1 -1
  107. package/dist/tabs-XluwRjgg.js +210 -0
  108. package/dist/tabs.js +1 -1
  109. package/dist/{text-field-C8TWG-tY.js → text-field-hU72iSVS.js} +15 -13
  110. package/dist/text-field.js +1 -1
  111. package/dist/{textarea-BrW0XcG_.js → textarea-3k4Y0QQ3.js} +18 -16
  112. package/dist/textarea.js +1 -1
  113. package/dist/theme-root.js +1 -1
  114. package/dist/theme-switch-C505TtU8.js +166 -0
  115. package/dist/theme-switch.js +2 -0
  116. package/dist/{time-picker-Db8D49cP.js → time-picker-CPlhW0tr.js} +26 -20
  117. package/dist/time-picker.js +1 -1
  118. package/dist/{timeline-k3nURuCP.js → timeline-B0uAAVfT.js} +8 -2
  119. package/dist/timeline.js +1 -1
  120. package/dist/{toast-BHxI32ZA.js → toast-B7wo3sX1.js} +98 -79
  121. package/dist/{toast-stack-DqrAzdg5.js → toast-stack-B40VpS4M.js} +18 -4
  122. package/dist/toast-stack.js +1 -1
  123. package/dist/toast.js +1 -1
  124. package/dist/{toggle-group-fcjzpifI.js → toggle-group-B2fpFZwV.js} +1 -1
  125. package/dist/toggle-group.js +1 -1
  126. package/dist/tooltip-BvgVTCTN.js +120 -0
  127. package/dist/tooltip.js +1 -1
  128. package/dist/{tree-view-C2liIxqy.js → tree-view-j8qLqkb_.js} +5 -1
  129. package/dist/tree-view.js +1 -1
  130. package/dist/types/components/checkbox/checkbox.d.ts +1 -1
  131. package/dist/types/components/command-palette/command-palette.d.ts +1 -1
  132. package/dist/types/components/comment-thread/comment-thread.d.ts +118 -0
  133. package/dist/types/components/comment-thread/index.d.ts +1 -0
  134. package/dist/types/components/comment-thread/thread-core.d.ts +96 -0
  135. package/dist/types/components/comment-thread/thread-parts.d.ts +114 -0
  136. package/dist/types/components/context-menu/context-menu.d.ts +55 -0
  137. package/dist/types/components/context-menu/index.d.ts +2 -0
  138. package/dist/types/components/date-range-picker/date-range-picker.d.ts +1 -1
  139. package/dist/types/components/elastic-slider/elastic-slider.d.ts +53 -0
  140. package/dist/types/components/elastic-slider/index.d.ts +1 -0
  141. package/dist/types/components/expanding-search/expanding-search.d.ts +22 -0
  142. package/dist/types/components/expanding-search/index.d.ts +1 -0
  143. package/dist/types/components/menu/menu.d.ts +50 -7
  144. package/dist/types/components/pagination/pagination.d.ts +1 -1
  145. package/dist/types/components/radio-cards/radio-cards.d.ts +1 -1
  146. package/dist/types/components/radio-group/radio-group.d.ts +1 -1
  147. package/dist/types/components/slider/slider-style.d.ts +14 -0
  148. package/dist/types/components/slider/slider.d.ts +2 -10
  149. package/dist/types/components/slider/use-slider-interaction.d.ts +79 -0
  150. package/dist/types/components/split-button/split-button.d.ts +2 -2
  151. package/dist/types/components/tabs/tabs.d.ts +1 -1
  152. package/dist/types/components/text-field/text-field.d.ts +1 -1
  153. package/dist/types/components/textarea/textarea.d.ts +1 -1
  154. package/dist/types/components/theme-switch/index.d.ts +1 -0
  155. package/dist/types/components/theme-switch/theme-switch.d.ts +33 -0
  156. package/dist/types/components/tooltip/tooltip.d.ts +1 -1
  157. package/dist/types/index.d.ts +5 -0
  158. package/dist/types/overlay/overlay-layer.d.ts +20 -0
  159. package/dist/types/overlay/use-overlay-floating.d.ts +9 -2
  160. package/dist/{use-overlay-floating-DvJifLpF.js → use-overlay-floating-Bx2jBKAA.js} +8 -6
  161. package/dist/use-slider-interaction-ChL-208h.js +234 -0
  162. package/package.json +22 -2
  163. package/dist/accordion-xCI_u0BV.js +0 -198
  164. package/dist/avatar-BahDVO9t.js +0 -132
  165. package/dist/badge-B_sLygxU.js +0 -108
  166. package/dist/card-D-aI2QHx.js +0 -158
  167. package/dist/carousel-IvPqN-oM.js +0 -472
  168. package/dist/command-palette-BQ5LleGb.js +0 -384
  169. package/dist/date-range-picker-B5uFWsm-.js +0 -562
  170. package/dist/file-dropzone-pR4v7owg.js +0 -457
  171. package/dist/mention-input-BcQKX2EJ.js +0 -599
  172. package/dist/menu-xwOOUtWP.js +0 -275
  173. package/dist/pill-DO2gHzMb.js +0 -56
  174. package/dist/popover-QHcEvf9c.js +0 -119
  175. package/dist/slider-t0B5cecO.js +0 -477
  176. package/dist/switch-qwv8jQnR.js +0 -142
  177. package/dist/tabs-CAVJndX1.js +0 -203
  178. package/dist/tooltip-CkeiW9C1.js +0 -113
  179. package/dist/{theme-root-BbTBuLMQ.js → theme-root-Bs1U3uPA.js} +2 -2
@@ -5,113 +5,117 @@ import { n as r, r as i } from "./media-8yrN85VT.js";
5
5
  import { t as a } from "./use-controlled-state-DpeVQZNR.js";
6
6
  import { t as o } from "./visually-hidden-BJdvqqvn.js";
7
7
  import { t as s } from "./renderable-DzcIj1Lo.js";
8
- import { t as c } from "./button-C92uYFJW.js";
9
- import { t as l } from "./radio-group-E6mMRgo7.js";
8
+ import { t as c } from "./button-NLY0h6EJ.js";
9
+ import { t as l } from "./radio-group-TIK0-iPX.js";
10
10
  import { useEffect as u, useId as ee, useImperativeHandle as te, useLayoutEffect as d, useRef as f, useState as ne } from "react";
11
11
  import { vars as p } from "@jfrader/tokens/vars";
12
12
  import { jsx as m, jsxs as h } from "@emotion/react/jsx-runtime";
13
13
  import { useMergeRefs as re } from "@floating-ui/react";
14
14
  import { base as g } from "@jfrader/tokens";
15
15
  //#region src/components/signature-pad/signature-pad.tsx
16
- var _ = 600, v = 260, ie = 4096, ae = 1e5, oe = 1e3, se = 2, ce = 3, le = 60, ue = 8e3, de = 500, fe = [], y = (e) => s(e) && e !== "", b = {
16
+ var _ = 600, v = 260, ie = 4096, y = 1e5, ae = 1e3, oe = 2, se = 3, ce = 60, le = 8e3, ue = 500, de = [], b = (e) => s(e) && e !== "", x = {
17
17
  fine: 2,
18
18
  medium: 4,
19
19
  bold: 7
20
- }, x = {
20
+ }, S = {
21
21
  black: g.color.signatureInkBlack,
22
22
  blue: g.color.signatureInkBlue,
23
23
  violet: g.color.signatureInkViolet
24
- }, pe = {
24
+ }, fe = {
25
25
  black: "--ui-color-text",
26
26
  blue: "--ui-color-info",
27
27
  violet: "--ui-color-accent"
28
- }, S = class extends Error {
28
+ }, C = class extends Error {
29
29
  code;
30
30
  constructor(e, t) {
31
31
  super(t), this.code = e, this.name = "SignatureExportError";
32
32
  }
33
- }, C = 0;
34
- function me() {
33
+ }, w = 0;
34
+ function pe() {
35
35
  let e = /* @__PURE__ */ new Uint32Array(2);
36
- return globalThis.crypto?.getRandomValues?.(e), [++C, ...e].map((e) => e.toString(36)).join("-");
36
+ return globalThis.crypto?.getRandomValues?.(e), [++w, ...e].map((e) => e.toString(36)).join("-");
37
37
  }
38
- function he(e) {
38
+ function me(e) {
39
39
  let t = 0;
40
- if (!Array.isArray(e) || e.length > oe) return !1;
40
+ if (!Array.isArray(e) || e.length > ae) return !1;
41
41
  for (let n of e) {
42
- if (!n || typeof n.id != "string" || !Object.hasOwn(b, n.width) || !Object.hasOwn(x, n.color) || !Number.isFinite(n.startTime) || n.startTime < 0 || !Array.isArray(n.points) || !n.points.length) return !1;
42
+ if (!n || typeof n.id != "string" || !Object.hasOwn(x, n.width) || !Object.hasOwn(S, n.color) || !Number.isFinite(n.startTime) || n.startTime < 0 || !Array.isArray(n.points) || !n.points.length) return !1;
43
43
  let e = 0;
44
44
  for (let r of n.points) {
45
- if (++t > ae || !r || !Number.isFinite(r.x) || !Number.isFinite(r.y) || r.x < 0 || r.x > _ || r.y < 0 || r.y > v || !Number.isFinite(r.time) || r.time < e || r.pressure !== null && (!Number.isFinite(r.pressure) || r.pressure < 0 || r.pressure > 1)) return !1;
45
+ if (++t > y || !r || !Number.isFinite(r.x) || !Number.isFinite(r.y) || r.x < 0 || r.x > _ || r.y < 0 || r.y > v || !Number.isFinite(r.time) || r.time < e || r.pressure !== null && (!Number.isFinite(r.pressure) || r.pressure < 0 || r.pressure > 1)) return !1;
46
46
  e = r.time;
47
47
  }
48
48
  }
49
49
  return !0;
50
50
  }
51
- function w(e) {
52
- if (!he(e)) throw new S("invalid", "Invalid signature strokes.");
51
+ function T(e) {
52
+ if (!me(e)) throw new C("invalid", "Invalid signature strokes.");
53
53
  }
54
- var T = (e, t, n) => Math.min(n, Math.max(t, e));
55
- function E(e) {
56
- if (he(e)) return e;
57
- let t = [];
58
- for (let n of Array.isArray(e) ? e.slice(0, oe) : []) {
59
- if (!n || !Object.hasOwn(b, n.width) || !Object.hasOwn(x, n.color) || !Array.isArray(n.points)) continue;
60
- let e = 0, r = [];
61
- for (let t of n.points) t && Number.isFinite(t.x) && Number.isFinite(t.y) && (Number.isFinite(t.time) && (e = Math.max(e, t.time)), r.push({
62
- x: T(t.x, 0, _),
63
- y: T(t.y, 0, v),
64
- pressure: Number.isFinite(t.pressure) ? T(t.pressure, 0, 1) : null,
65
- time: e
66
- }));
67
- r.length && t.push({
68
- ...n,
69
- startTime: Number.isFinite(n.startTime) ? Math.max(0, n.startTime) : 0,
70
- points: r
54
+ var E = (e, t, n) => Math.min(n, Math.max(t, e));
55
+ function D(e) {
56
+ if (me(e)) return e;
57
+ let t = [], n = 0;
58
+ for (let r of Array.isArray(e) ? e.slice(0, ae) : []) {
59
+ if (n >= y) break;
60
+ if (!r || !Object.hasOwn(x, r.width) || !Object.hasOwn(S, r.color) || !Array.isArray(r.points)) continue;
61
+ let e = 0, i = [];
62
+ for (let t of r.points) {
63
+ if (n >= y) break;
64
+ n++, t && Number.isFinite(t.x) && Number.isFinite(t.y) && (Number.isFinite(t.time) && (e = Math.max(e, t.time)), i.push({
65
+ x: E(t.x, 0, _),
66
+ y: E(t.y, 0, v),
67
+ pressure: Number.isFinite(t.pressure) ? E(t.pressure, 0, 1) : null,
68
+ time: e
69
+ }));
70
+ }
71
+ i.length && t.push({
72
+ ...r,
73
+ startTime: Number.isFinite(r.startTime) ? Math.max(0, r.startTime) : 0,
74
+ points: i
71
75
  });
72
76
  }
73
77
  return t;
74
78
  }
75
- var ge = (e) => e.reduce((e, t) => e + t.points.length, 0), D = (e, t) => ({
79
+ var he = (e) => e.reduce((e, t) => e + t.points.length, 0), O = (e, t) => ({
76
80
  x: (e.x + t.x) / 2,
77
81
  y: (e.y + t.y) / 2,
78
82
  time: (e.time + t.time) / 2,
79
83
  pressure: e.pressure === null || t.pressure === null ? null : (e.pressure + t.pressure) / 2
80
- }), O = (e, t) => b[t] * (e.pressure === null ? 1 : .25 + e.pressure * .75);
81
- function k(e) {
84
+ }), k = (e, t) => x[t] * (e.pressure === null ? 1 : .25 + e.pressure * .75);
85
+ function A(e) {
82
86
  let t = [];
83
87
  for (let n = 1; n < e.points.length; n++) {
84
- let r = e.points[n - 1], i = e.points[n], a = n === 1 ? r : D(e.points[n - 2], r), o = n === e.points.length - 1 ? i : D(r, i);
88
+ let r = e.points[n - 1], i = e.points[n], a = n === 1 ? r : O(e.points[n - 2], r), o = n === e.points.length - 1 ? i : O(r, i);
85
89
  t.push({
86
90
  from: a,
87
91
  control: r,
88
92
  to: o,
89
- width: (O(r, e.width) + O(i, e.width)) / 2
93
+ width: (k(r, e.width) + k(i, e.width)) / 2
90
94
  });
91
95
  }
92
96
  return t;
93
97
  }
94
- function _e(e, t, n) {
98
+ function ge(e, t, n) {
95
99
  for (let r of t) {
96
100
  if (e.strokeStyle = e.fillStyle = n[r.color], e.lineCap = e.lineJoin = "round", r.points.length === 1) {
97
101
  let t = r.points[0];
98
- e.beginPath(), e.arc(t.x, t.y, O(t, r.width) / 2, 0, Math.PI * 2), e.fill();
102
+ e.beginPath(), e.arc(t.x, t.y, k(t, r.width) / 2, 0, Math.PI * 2), e.fill();
99
103
  }
100
- for (let t of k(r)) e.lineWidth = t.width, e.beginPath(), e.moveTo(t.from.x, t.from.y), e.quadraticCurveTo(t.control.x, t.control.y, t.to.x, t.to.y), e.stroke();
104
+ for (let t of A(r)) e.lineWidth = t.width, e.beginPath(), e.moveTo(t.from.x, t.from.y), e.quadraticCurveTo(t.control.x, t.control.y, t.to.x, t.to.y), e.stroke();
101
105
  }
102
106
  }
103
- function A(e, t) {
104
- if (w(e), !e.length) throw new S("empty", "Cannot export an empty signature.");
107
+ function j(e, t) {
108
+ if (T(e), !e.length) throw new C("empty", "Cannot export an empty signature.");
105
109
  let n = 0, r = 0, i = _, a = v;
106
110
  if (t.crop !== !1) {
107
111
  n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
108
112
  for (let t of e) for (let e of t.points) {
109
- let o = b[t.width] / 2 + se;
113
+ let o = x[t.width] / 2 + oe;
110
114
  n = Math.min(n, e.x - o), r = Math.min(r, e.y - o), i = Math.max(i, e.x + o), a = Math.max(a, e.y + o);
111
115
  }
112
116
  }
113
- let o = t.scale ?? ce, s = i - n, c = a - r;
114
- if (!Number.isFinite(o) || o <= 0 || Math.ceil(s * o) > ie || Math.ceil(c * o) > ie) throw new S("size", "Signature export exceeds the dimension budget.");
117
+ let o = t.scale ?? se, s = i - n, c = a - r;
118
+ if (!Number.isFinite(o) || o <= 0 || Math.ceil(s * o) > ie || Math.ceil(c * o) > ie) throw new C("size", "Signature export exceeds the dimension budget.");
115
119
  return {
116
120
  left: n,
117
121
  top: r,
@@ -120,46 +124,46 @@ function A(e, t) {
120
124
  scale: o
121
125
  };
122
126
  }
123
- function ve(e, t = {}) {
124
- let n = A(e, t);
125
- if (typeof document > "u") throw new S("encoder", "Canvas rendering is unavailable.");
127
+ function _e(e, t = {}) {
128
+ let n = j(e, t);
129
+ if (typeof document > "u") throw new C("encoder", "Canvas rendering is unavailable.");
126
130
  let r = document.createElement("canvas");
127
131
  r.width = Math.ceil(n.width * n.scale), r.height = Math.ceil(n.height * n.scale);
128
132
  let i = r.getContext("2d");
129
- if (!i) throw new S("encoder", "Canvas rendering is unavailable.");
130
- return i.scale(n.scale, n.scale), i.translate(-n.left, -n.top), _e(i, e, x), r;
133
+ if (!i) throw new C("encoder", "Canvas rendering is unavailable.");
134
+ return i.scale(n.scale, n.scale), i.translate(-n.left, -n.top), ge(i, e, S), r;
131
135
  }
132
- function ye(e, t = {}) {
136
+ function ve(e, t = {}) {
133
137
  return new Promise((n, r) => {
134
138
  try {
135
- ve(e, t).toBlob((e) => e ? n(e) : r(new S("encoder", "PNG encoding failed.")), "image/png");
139
+ _e(e, t).toBlob((e) => e ? n(e) : r(new C("encoder", "PNG encoding failed.")), "image/png");
136
140
  } catch (e) {
137
141
  r(e);
138
142
  }
139
143
  });
140
144
  }
141
- function be(e, t = {}) {
142
- let n = A(e, t), r = e.map((e) => {
143
- let t = x[e.color];
145
+ function ye(e, t = {}) {
146
+ let n = j(e, t), r = e.map((e) => {
147
+ let t = S[e.color];
144
148
  if (e.points.length === 1) {
145
149
  let n = e.points[0];
146
- return `<circle cx="${n.x}" cy="${n.y}" r="${O(n, e.width) / 2}" fill="${t}"/>`;
150
+ return `<circle cx="${n.x}" cy="${n.y}" r="${k(n, e.width) / 2}" fill="${t}"/>`;
147
151
  }
148
- return k(e).map((e) => `<path d="M ${e.from.x} ${e.from.y} Q ${e.control.x} ${e.control.y} ${e.to.x} ${e.to.y}" fill="none" stroke="${t}" stroke-width="${e.width}" stroke-linecap="round" stroke-linejoin="round"/>`).join("");
152
+ return A(e).map((e) => `<path d="M ${e.from.x} ${e.from.y} Q ${e.control.x} ${e.control.y} ${e.to.x} ${e.to.y}" fill="none" stroke="${t}" stroke-width="${e.width}" stroke-linecap="round" stroke-linejoin="round"/>`).join("");
149
153
  }).join("");
150
154
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${n.left} ${n.top} ${n.width} ${n.height}" width="${Math.ceil(n.width * n.scale)}" height="${Math.ceil(n.height * n.scale)}">${r}</svg>`;
151
155
  }
152
- var xe = e({
156
+ var be = e({
153
157
  display: "grid",
154
158
  gap: p.space[3],
155
159
  minInlineSize: 0,
156
160
  color: p.color.text,
157
161
  fontFamily: p.font.sans,
158
162
  fontSize: p.textSize.sm
159
- }), Se = e({
163
+ }), xe = e({
160
164
  position: "relative",
161
165
  minInlineSize: 0
162
- }), Ce = e({
166
+ }), Se = e({
163
167
  display: "block",
164
168
  boxSizing: "border-box",
165
169
  inlineSize: "100%",
@@ -175,7 +179,7 @@ var xe = e({
175
179
  borderColor: "CanvasText",
176
180
  color: "CanvasText"
177
181
  }
178
- }), we = e({
182
+ }), Ce = e({
179
183
  position: "absolute",
180
184
  insetInline: p.space[4],
181
185
  insetBlockEnd: p.space[8],
@@ -189,30 +193,30 @@ var xe = e({
189
193
  transitionProperty: "opacity",
190
194
  transitionDuration: p.motion.duration.base,
191
195
  [i]: { transitionDuration: "0s" }
192
- }), Te = e({
196
+ }), we = e({
193
197
  display: "flex",
194
198
  flexWrap: "wrap",
195
199
  alignItems: "center",
196
200
  gap: p.space[3]
197
- }), Ee = e({ fontWeight: p.fontWeight.medium }), De = e({ color: p.color.textMuted }), Oe = e({ color: p.color.dangerText }), j = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t);
198
- function M({ ref: e, apiRef: n, value: r, defaultValue: i = fe, onValueChange: s, color: p, defaultColor: g = "black", onColorChange: ie, width: se, defaultWidth: ce = "medium", onWidthChange: S, label: C, description: w, error: T, signer: D, hint: O, disabled: k = !1, readOnly: A = !1, required: M = !1, replay: ke = !0, download: Ae = !1, fileName: je = "signature", historyLimit: Me = le, messages: N, icons: Ne, exportOptions: P, slotProps: F, className: Pe, sx: Fe, dir: Ie, style: Le, onPointerDown: Re, onPointerMove: ze, onPointerUp: Be, onPointerCancel: Ve, onLostPointerCapture: He, onKeyDown: Ue, "aria-labelledby": We, "aria-describedby": Ge, ...I }) {
199
- let L = ee(), R = f(null), Ke = re([R, e]), qe = f(i), [z = fe, Je] = a(r, qe.current, s), [Ye = "black", Xe] = a(p, g, ie), [Ze = "medium", Qe] = a(se, ce, S), B = f({
200
- present: z,
201
+ }), Te = e({ fontWeight: p.fontWeight.medium }), Ee = e({ color: p.color.textMuted }), De = e({ color: p.color.dangerText }), M = (e, t) => e === t || JSON.stringify(e) === JSON.stringify(t);
202
+ function N({ ref: e, apiRef: n, value: r, defaultValue: i = de, onValueChange: s, color: p, defaultColor: g = "black", onColorChange: ie, width: oe, defaultWidth: se = "medium", onWidthChange: C, label: w, description: T, error: E, signer: O, hint: k, disabled: A = !1, readOnly: j = !1, required: N = !1, replay: Oe = !0, download: ke = !1, fileName: Ae = "signature", historyLimit: je = ce, messages: P, icons: Me, exportOptions: F, slotProps: I, className: Ne, sx: Pe, dir: Fe, style: Ie, onPointerDown: Le, onPointerMove: Re, onPointerUp: ze, onPointerCancel: Be, onLostPointerCapture: Ve, onKeyDown: He, "aria-labelledby": Ue, "aria-describedby": We, ...L }) {
203
+ let R = ee(), z = f(null), Ge = re([z, e]), Ke = f(i), [B = de, qe] = a(r, Ke.current, s), [Je = "black", Ye] = a(p, g, ie), [Xe = "medium", Ze] = a(oe, se, C), V = f({
204
+ present: B,
201
205
  past: [],
202
206
  future: []
203
- }), V = f(null), H = f(null), U = f(null), $e = f(null), [et, tt] = ne({
207
+ }), H = f(null), U = f(null), W = f(null), Qe = f(null), [$e, et] = ne({
204
208
  text: "",
205
209
  revision: 0
206
210
  });
207
- function W(e) {
208
- tt((t) => ({
211
+ function G(e) {
212
+ et((t) => ({
209
213
  text: e,
210
214
  revision: t.revision + 1
211
215
  }));
212
216
  }
213
- let [nt, rt] = ne(!1), [, it] = ne(0), G = k || A, at = Number.isFinite(Me) && Me > 0 ? Math.floor(Me) : le;
214
- function K(e = H.current ? [...B.current.present, H.current.stroke] : B.current.present) {
215
- let t = R.current;
217
+ let [tt, nt] = ne(!1), [, rt] = ne(0), K = A || j, it = Number.isFinite(je) && je > 0 ? Math.floor(je) : ce;
218
+ function q(e = U.current ? [...V.current.present, U.current.stroke] : V.current.present) {
219
+ let t = z.current;
216
220
  if (!t) return;
217
221
  let n = t.getBoundingClientRect();
218
222
  if (n.width <= 0 || n.height <= 0 || t.clientWidth <= 0 || t.clientHeight <= 0) return;
@@ -221,120 +225,120 @@ function M({ ref: e, apiRef: n, value: r, defaultValue: i = fe, onValueChange: s
221
225
  let s = t.getContext("2d");
222
226
  if (!s) return;
223
227
  s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, t.width, t.height), s.setTransform(t.width / _, 0, 0, t.height / v, 0, 0);
224
- let c = r.getComputedStyle(t), l = r.matchMedia("(forced-colors: active)").matches, u = Object.fromEntries(Object.entries(pe).map(([e, t]) => [e, l ? c.color : c.getPropertyValue(t).trim()]));
225
- _e(s, E(e), u);
226
- }
227
- function q() {
228
- U.current !== null && R.current?.ownerDocument.defaultView?.cancelAnimationFrame(U.current), U.current = null, rt(!1), K();
228
+ let c = r.getComputedStyle(t), l = r.matchMedia("(forced-colors: active)").matches, u = Object.fromEntries(Object.entries(fe).map(([e, t]) => [e, l ? c.color : c.getPropertyValue(t).trim()]));
229
+ ge(s, D(e), u);
229
230
  }
230
231
  function J() {
231
- q(), W(N.replayComplete);
232
+ W.current !== null && z.current?.ownerDocument.defaultView?.cancelAnimationFrame(W.current), W.current = null, nt(!1), q();
232
233
  }
233
234
  function Y() {
234
- let e = H.current?.pointerId;
235
- H.current = null;
236
- let t = R.current;
237
- e !== void 0 && t?.hasPointerCapture(e) && t.releasePointerCapture(e), K();
235
+ J(), G(P.replayComplete);
236
+ }
237
+ function X() {
238
+ let e = U.current?.pointerId;
239
+ U.current = null;
240
+ let t = z.current;
241
+ e !== void 0 && t?.hasPointerCapture(e) && t.releasePointerCapture(e), q();
238
242
  }
239
- function ot(e, t, n) {
240
- j(e, B.current.present) || (q(), Y(), V.current = {
243
+ function at(e, t, n) {
244
+ M(e, V.current.present) || (J(), X(), H.current = {
241
245
  value: e,
242
246
  history: t,
243
247
  status: n
244
- }, Je(e));
248
+ }, qe(e));
245
249
  }
246
- function st() {
247
- let e = B.current;
248
- if (G || !e.past.length) return;
250
+ function ot() {
251
+ let e = V.current;
252
+ if (K || !e.past.length) return;
249
253
  let t = e.past[e.past.length - 1];
250
- ot(t, {
254
+ at(t, {
251
255
  present: t,
252
256
  past: e.past.slice(0, -1),
253
- future: [e.present, ...e.future].slice(0, at)
254
- }, N.undone);
257
+ future: [e.present, ...e.future].slice(0, it)
258
+ }, P.undone);
255
259
  }
256
- function X() {
257
- let e = B.current;
258
- if (G || !e.future.length) return;
260
+ function st() {
261
+ let e = V.current;
262
+ if (K || !e.future.length) return;
259
263
  let t = e.future[0];
260
- ot(t, {
264
+ at(t, {
261
265
  present: t,
262
- past: [...e.past, e.present].slice(-at),
266
+ past: [...e.past, e.present].slice(-it),
263
267
  future: e.future.slice(1)
264
- }, N.redone);
268
+ }, P.redone);
265
269
  }
266
270
  function Z(e, t) {
267
- let n = B.current;
268
- ot(e, {
271
+ let n = V.current;
272
+ at(e, {
269
273
  present: e,
270
- past: [...n.past, n.present].slice(-at),
274
+ past: [...n.past, n.present].slice(-it),
271
275
  future: []
272
276
  }, t);
273
277
  }
274
278
  function ct() {
275
- G || Z(fe, N.cleared);
279
+ K || Z(de, P.cleared);
276
280
  }
277
281
  function lt() {
278
- q(), Y();
279
- let e = E(B.current.present), t = R.current?.ownerDocument.defaultView;
280
- if (k || !e.length || !t) return;
282
+ J(), X();
283
+ let e = D(V.current.present), t = z.current?.ownerDocument.defaultView;
284
+ if (A || !e.length || !t) return;
281
285
  if (t.matchMedia("(prefers-reduced-motion: reduce)").matches) {
282
- J();
286
+ Y();
283
287
  return;
284
288
  }
285
289
  let n = [], r = 0;
286
290
  e.forEach((t, i) => {
287
- let a = e[i - 1], o = a ? Math.min(de, Math.max(0, t.startTime - a.startTime - a.points.at(-1).time)) : 0, s = t.points.at(-1).time;
291
+ let a = e[i - 1], o = a ? Math.min(ue, Math.max(0, t.startTime - a.startTime - a.points.at(-1).time)) : 0, s = t.points.at(-1).time;
288
292
  n.push({
289
293
  stroke: t,
290
294
  offset: r + o
291
295
  }), r += o + s;
292
296
  });
293
- let i = r > ue ? ue / r : 1, a = t.performance.now();
294
- rt(!0);
297
+ let i = r > le ? le / r : 1, a = t.performance.now();
298
+ nt(!0);
295
299
  let o = (e) => {
296
300
  let s = (e - a) / i;
297
- K(n.flatMap(({ stroke: e, offset: t }) => {
301
+ q(n.flatMap(({ stroke: e, offset: t }) => {
298
302
  if (s < t) return [];
299
303
  let n = e.points.filter((e) => e.time <= s - t);
300
304
  return n.length ? [{
301
305
  ...e,
302
306
  points: n
303
307
  }] : [];
304
- })), s >= r ? J() : U.current = t.requestAnimationFrame(o);
308
+ })), s >= r ? Y() : W.current = t.requestAnimationFrame(o);
305
309
  };
306
- U.current = t.requestAnimationFrame(o);
310
+ W.current = t.requestAnimationFrame(o);
307
311
  }
308
312
  let Q = f(null);
309
313
  u(() => {
310
- process.env.NODE_ENV !== "production" && (he(z) ? Q.current = null : (Q.current === null || !j(Q.current, z)) && (Q.current = z, console.warn("SignaturePad: value contains malformed strokes; invalid samples are skipped when drawing and exports reject with an \"invalid\" SignatureExportError.")));
311
- }, [z]), d(() => {
312
- j(z, B.current.present) || (Y(), q(), V.current && j(z, V.current.value) ? (B.current = V.current.history, W(V.current.status)) : B.current = {
313
- present: z,
314
+ process.env.NODE_ENV !== "production" && (me(B) ? Q.current = null : (Q.current === null || !M(Q.current, B)) && (Q.current = B, console.warn("SignaturePad: value contains malformed strokes; invalid samples are skipped when drawing and exports reject with an \"invalid\" SignatureExportError.")));
315
+ }, [B]), d(() => {
316
+ M(B, V.current.present) || (X(), J(), H.current && M(B, H.current.value) ? (V.current = H.current.history, G(H.current.status)) : V.current = {
317
+ present: B,
314
318
  past: [],
315
319
  future: []
316
- }, V.current = null, it((e) => e + 1)), U.current === null && K(H.current ? [...B.current.present, H.current.stroke] : B.current.present);
320
+ }, H.current = null, rt((e) => e + 1)), W.current === null && q(U.current ? [...V.current.present, U.current.stroke] : V.current.present);
317
321
  }), d(() => {
318
- G && (Y(), q());
319
- }, [G]);
322
+ K && (X(), J());
323
+ }, [K]);
320
324
  let $ = f({
321
- draw: K,
322
- completeReplay: J,
325
+ draw: q,
326
+ completeReplay: Y,
323
327
  reset: () => {
324
- G || Z(qe.current, N.reset);
328
+ K || Z(Ke.current, P.reset);
325
329
  }
326
330
  });
327
331
  d(() => {
328
332
  $.current = {
329
- draw: K,
330
- completeReplay: J,
333
+ draw: q,
334
+ completeReplay: Y,
331
335
  reset: () => {
332
- G || Z(qe.current, N.reset);
336
+ K || Z(Ke.current, P.reset);
333
337
  }
334
338
  };
335
339
  }), d(() => {
336
- let e = R.current, t = e.ownerDocument.defaultView, n = () => {
337
- U.current === null && $.current.draw();
340
+ let e = z.current, t = e.ownerDocument.defaultView, n = () => {
341
+ W.current === null && $.current.draw();
338
342
  }, r = new ResizeObserver(n);
339
343
  r.observe(e);
340
344
  let i = new MutationObserver(n);
@@ -349,7 +353,7 @@ function M({ ref: e, apiRef: n, value: r, defaultValue: i = fe, onValueChange: s
349
353
  let a = t.matchMedia("(forced-colors: active)");
350
354
  a.addEventListener("change", n);
351
355
  let o = t.matchMedia("(prefers-reduced-motion: reduce)"), s = () => {
352
- o.matches && U.current !== null && $.current.completeReplay();
356
+ o.matches && W.current !== null && $.current.completeReplay();
353
357
  };
354
358
  o.addEventListener("change", s);
355
359
  let c = t.matchMedia(`(resolution: ${t.devicePixelRatio}dppx)`), l = () => {
@@ -362,233 +366,234 @@ function M({ ref: e, apiRef: n, value: r, defaultValue: i = fe, onValueChange: s
362
366
  });
363
367
  };
364
368
  return u?.addEventListener("reset", ee), () => {
365
- r.disconnect(), i.disconnect(), a.removeEventListener("change", n), o.removeEventListener("change", s), c.removeEventListener("change", l), t.removeEventListener("resize", n), u?.removeEventListener("reset", ee), U.current !== null && t.cancelAnimationFrame(U.current), U.current = null, H.current = null;
369
+ r.disconnect(), i.disconnect(), a.removeEventListener("change", n), o.removeEventListener("change", s), c.removeEventListener("change", l), t.removeEventListener("resize", n), u?.removeEventListener("reset", ee), W.current !== null && t.cancelAnimationFrame(W.current), W.current = null, U.current = null;
366
370
  };
367
371
  }, []);
368
372
  function ut(e) {
369
- return R.current && W(N.exported), e;
373
+ return z.current && G(P.exported), e;
370
374
  }
371
375
  function dt(e) {
372
- if (G || e.key !== "Home" && e.key !== "End") return;
376
+ if (K || e.key !== "Home" && e.key !== "End") return;
373
377
  let t = e.currentTarget.querySelectorAll("input[type=\"radio\"]:not(:disabled)"), n = e.key === "Home" ? t[0] : t[t.length - 1];
374
378
  n && (e.preventDefault(), n.focus(), n.click());
375
379
  }
376
380
  te(n, () => ({
377
- focus: () => R.current?.focus(),
381
+ focus: () => z.current?.focus(),
378
382
  clear: ct,
379
- undo: st,
380
- redo: X,
383
+ undo: ot,
384
+ redo: st,
381
385
  replay: lt,
382
- stopReplay: q,
383
- toDataURL: (e) => ut(ve(B.current.present, e ?? P).toDataURL("image/png")),
384
- toBlob: (e) => ye(B.current.present, e ?? P).then(ut),
385
- toSvg: (e) => ut(be(B.current.present, e ?? P))
386
+ stopReplay: J,
387
+ toDataURL: (e) => ut(_e(V.current.present, e ?? F).toDataURL("image/png")),
388
+ toBlob: (e) => ve(V.current.present, e ?? F).then(ut),
389
+ toSvg: (e) => ut(ye(V.current.present, e ?? F))
386
390
  }));
387
391
  function ft(e, t) {
388
- let n = R.current, r = n.getBoundingClientRect(), i = n.clientWidth, a = n.clientHeight;
392
+ let n = z.current, r = n.getBoundingClientRect(), i = n.clientWidth, a = n.clientHeight;
389
393
  if (i <= 0 || a <= 0 || !Number.isFinite(e.clientX) || !Number.isFinite(e.clientY)) return;
390
394
  let o = t.stroke.points, s = Math.max(o.at(-1)?.time ?? 0, Number.isFinite(e.timeStamp) ? e.timeStamp - t.started : 0), c = {
391
395
  x: Math.max(0, Math.min(_, (e.clientX - r.left - n.clientLeft) / i * _)),
392
396
  y: Math.max(0, Math.min(v, (e.clientY - r.top - n.clientTop) / a * v)),
393
397
  pressure: e.pointerType === "pen" && Number.isFinite(e.pressure) ? Math.max(0, Math.min(1, e.pressure)) : null,
394
398
  time: s
395
- }, l = o.at(-1), u = ae - ge(E(B.current.present));
399
+ }, l = o.at(-1), u = y - he(D(V.current.present));
396
400
  (!l || l.x !== c.x || l.y !== c.y) && o.length < u && o.push(c);
397
401
  }
398
402
  function pt(e) {
399
- let t = H.current;
403
+ let t = U.current;
400
404
  if (!t || e.pointerId !== t.pointerId) return;
401
405
  let n = e.nativeEvent.getCoalescedEvents?.() ?? [];
402
406
  for (let e of n) ft(e, t);
403
- ft(e.nativeEvent, t), K([...B.current.present, t.stroke]);
407
+ ft(e.nativeEvent, t), q([...V.current.present, t.stroke]);
404
408
  }
405
409
  async function mt(e) {
406
410
  try {
407
- let t = e === "png" ? await ye(B.current.present, P) : new Blob([be(B.current.present, P)], { type: "image/svg+xml" }), n = R.current?.ownerDocument;
411
+ let t = e === "png" ? await ve(V.current.present, F) : new Blob([ye(V.current.present, F)], { type: "image/svg+xml" }), n = z.current?.ownerDocument;
408
412
  if (!n) return;
409
413
  let r = URL.createObjectURL(t);
410
414
  try {
411
415
  let t = n.createElement("a");
412
- t.href = r, t.download = `${je.replace(/[\\/\u0000-\u001f:*?"<>|]/g, "_") || "signature"}.${e}`, t.click(), W(N.exported);
416
+ t.href = r, t.download = `${Ae.replace(/[\\/\u0000-\u001f:*?"<>|]/g, "_") || "signature"}.${e}`, t.click(), G(P.exported);
413
417
  } finally {
414
418
  URL.revokeObjectURL(r);
415
419
  }
416
420
  } catch {
417
- R.current && W(N.exportFailed);
421
+ z.current && G(P.exportFailed);
418
422
  }
419
423
  }
420
- let ht = B.current, gt = [
424
+ let ht = V.current, gt = [
421
425
  {
422
426
  action: "undo",
423
- disabled: G || !ht.past.length,
424
- run: st
427
+ disabled: K || !ht.past.length,
428
+ run: ot
425
429
  },
426
430
  {
427
431
  action: "redo",
428
- disabled: G || !ht.future.length,
429
- run: X
432
+ disabled: K || !ht.future.length,
433
+ run: st
430
434
  },
431
- ...ke ? [{
432
- action: nt ? "stop" : "replay",
433
- disabled: k || !z.length,
434
- run: nt ? q : lt
435
+ ...Oe ? [{
436
+ action: tt ? "stop" : "replay",
437
+ disabled: A || !B.length,
438
+ run: tt ? J : lt
435
439
  }] : [],
436
440
  {
437
441
  action: "clear",
438
- disabled: G || !z.length,
442
+ disabled: K || !B.length,
439
443
  run: ct
440
444
  },
441
- ...Ae ? [{
445
+ ...ke ? [{
442
446
  action: "png",
443
- disabled: k || !z.length,
447
+ disabled: A || !B.length,
444
448
  run: () => {
445
449
  mt("png");
446
450
  }
447
451
  }, {
448
452
  action: "svg",
449
- disabled: k || !z.length,
453
+ disabled: A || !B.length,
450
454
  run: () => {
451
455
  mt("svg");
452
456
  }
453
457
  }] : []
454
458
  ];
455
459
  return /* @__PURE__ */ m(t, {
456
- className: [Pe, F?.root?.className].filter(Boolean).join(" "),
457
- styles: [xe, F?.root?.css],
458
- sx: Fe,
460
+ className: [Ne, I?.root?.className].filter(Boolean).join(" "),
461
+ styles: [be, I?.root?.css],
462
+ sx: Pe,
459
463
  children: (e) => /* @__PURE__ */ h("div", {
460
464
  "data-ui": "signature-pad",
461
- "data-state": z.length ? "signed" : "empty",
465
+ "data-state": B.length ? "signed" : "empty",
462
466
  className: e,
463
- dir: Ie,
464
- style: Le,
467
+ dir: Fe,
468
+ style: Ie,
465
469
  children: [
466
- y(C) && /* @__PURE__ */ m("span", {
467
- id: `${L}-label`,
468
- className: F?.label?.className,
469
- css: [Ee, F?.label?.css],
470
- children: C
470
+ b(w) && /* @__PURE__ */ m("span", {
471
+ id: `${R}-label`,
472
+ className: I?.label?.className,
473
+ css: [Te, I?.label?.css],
474
+ children: w
471
475
  }),
472
476
  /* @__PURE__ */ m("span", {
473
- id: `${L}-state`,
477
+ id: `${R}-state`,
474
478
  css: o,
475
- children: z.length ? N.signed : N.empty
479
+ children: B.length ? P.signed : P.empty
476
480
  }),
477
481
  /* @__PURE__ */ m("span", {
478
- id: `${L}-shortcuts`,
482
+ id: `${R}-shortcuts`,
479
483
  css: o,
480
- children: N.shortcuts
484
+ children: P.shortcuts
481
485
  }),
482
486
  /* @__PURE__ */ h("div", {
483
- css: Se,
487
+ css: xe,
484
488
  children: [/* @__PURE__ */ m("canvas", {
485
- ...I,
486
- ref: Ke,
489
+ ...L,
490
+ ref: Ge,
487
491
  role: "img",
488
- tabIndex: k ? -1 : I.tabIndex ?? 0,
489
- "aria-roledescription": N.roleDescription,
490
- "aria-disabled": k || void 0,
491
- "data-readonly": A || void 0,
492
- "aria-invalid": y(T) ? !0 : I["aria-invalid"],
492
+ tabIndex: A ? -1 : L.tabIndex ?? 0,
493
+ "aria-roledescription": P.roleDescription,
494
+ "aria-disabled": A || void 0,
495
+ "data-readonly": j || void 0,
496
+ "aria-invalid": b(E) ? !0 : L["aria-invalid"],
493
497
  "aria-labelledby": [
494
- We,
495
- y(C) && `${L}-label`,
496
- !I["aria-label"] && `${L}-state`
498
+ Ue,
499
+ b(w) && `${R}-label`,
500
+ !L["aria-label"] && `${R}-state`
497
501
  ].filter(Boolean).join(" ") || void 0,
498
502
  "aria-describedby": [
499
- Ge,
500
- `${L}-shortcuts`,
501
- M && `${L}-required`,
502
- y(w) && `${L}-description`,
503
- y(T) && `${L}-error`
503
+ We,
504
+ `${R}-state`,
505
+ `${R}-shortcuts`,
506
+ N && `${R}-required`,
507
+ b(T) && `${R}-description`,
508
+ b(E) && `${R}-error`
504
509
  ].filter(Boolean).join(" "),
505
- className: F?.canvas?.className,
506
- css: [Ce, F?.canvas?.css],
510
+ className: I?.canvas?.className,
511
+ css: [Se, I?.canvas?.css],
507
512
  onPointerDown: (e) => {
508
- if (Re?.(e), e.defaultPrevented || G || !e.isPrimary || e.button !== 0 || H.current || z.length >= oe || ge(E(z)) >= ae || e.currentTarget.clientWidth <= 0 || e.currentTarget.clientHeight <= 0) return;
509
- q(), V.current = null;
513
+ if (Le?.(e), e.defaultPrevented || K || !e.isPrimary || e.button !== 0 || U.current || B.length >= ae || he(D(B)) >= y || e.currentTarget.clientWidth <= 0 || e.currentTarget.clientHeight <= 0) return;
514
+ J(), H.current = null;
510
515
  let t = Number.isFinite(e.timeStamp) ? e.timeStamp : 0;
511
- $e.current ??= t;
516
+ Qe.current ??= t;
512
517
  let n = {
513
518
  pointerId: e.pointerId,
514
519
  started: t,
515
520
  stroke: {
516
- id: me(),
521
+ id: pe(),
517
522
  points: [],
518
- color: Ye,
519
- width: Ze,
520
- startTime: Math.max(0, t - $e.current)
523
+ color: Je,
524
+ width: Xe,
525
+ startTime: Math.max(0, t - Qe.current)
521
526
  }
522
527
  };
523
- H.current = n;
528
+ U.current = n;
524
529
  try {
525
530
  e.currentTarget.setPointerCapture(e.pointerId);
526
531
  } catch {
527
- H.current = null;
532
+ U.current = null;
528
533
  return;
529
534
  }
530
- ft(e.nativeEvent, n), K([...ht.present, n.stroke]), e.preventDefault();
535
+ ft(e.nativeEvent, n), q([...ht.present, n.stroke]), e.preventDefault();
531
536
  },
532
537
  onPointerMove: (e) => {
533
- ze?.(e), e.defaultPrevented || pt(e);
538
+ Re?.(e), e.defaultPrevented || pt(e);
534
539
  },
535
540
  onPointerUp: (e) => {
536
- if (Be?.(e), H.current?.pointerId !== e.pointerId) return;
541
+ if (ze?.(e), U.current?.pointerId !== e.pointerId) return;
537
542
  if (e.defaultPrevented) {
538
- Y();
543
+ X();
539
544
  return;
540
545
  }
541
546
  pt(e);
542
- let t = H.current.stroke;
543
- Y(), t.points.length && Z([...B.current.present, t], N.added);
547
+ let t = U.current.stroke;
548
+ X(), t.points.length && Z([...V.current.present, t], P.added);
544
549
  },
545
550
  onPointerCancel: (e) => {
546
- Ve?.(e), H.current?.pointerId === e.pointerId && Y();
551
+ Be?.(e), U.current?.pointerId === e.pointerId && X();
547
552
  },
548
553
  onLostPointerCapture: (e) => {
549
- He?.(e), H.current?.pointerId === e.pointerId && Y();
554
+ Ve?.(e), U.current?.pointerId === e.pointerId && X();
550
555
  },
551
556
  onKeyDown: (e) => {
552
- if (Ue?.(e), e.defaultPrevented || e.target !== e.currentTarget) return;
557
+ if (He?.(e), e.defaultPrevented || e.target !== e.currentTarget) return;
553
558
  let t = e.key.toLowerCase();
554
- t === "escape" && (nt || H.current) ? (q(), Y(), e.preventDefault(), e.stopPropagation()) : !G && (e.metaKey || e.ctrlKey) && (t === "z" || t === "y") ? (t === "y" || e.shiftKey ? X() : st(), e.preventDefault()) : !G && (t === "delete" || t === "backspace") && (ct(), e.preventDefault());
559
+ t === "escape" && (tt || U.current) ? (J(), X(), e.preventDefault(), e.stopPropagation()) : !K && (e.metaKey || e.ctrlKey) && (t === "z" || t === "y") ? (t === "y" || e.shiftKey ? st() : ot(), e.preventDefault()) : !K && (t === "delete" || t === "backspace") && (ct(), e.preventDefault());
555
560
  },
556
- children: N.fallback
557
- }), (y(O) || y(D)) && /* @__PURE__ */ h("div", {
561
+ children: P.fallback
562
+ }), (b(k) || b(O)) && /* @__PURE__ */ h("div", {
558
563
  "aria-hidden": "true",
559
564
  "data-ui": "signature-pad-guide",
560
- className: F?.guide?.className,
561
- css: [we, F?.guide?.css],
562
- children: [!z.length && y(O) && /* @__PURE__ */ m("span", { children: O }), y(D) && /* @__PURE__ */ m("span", { children: D })]
565
+ className: I?.guide?.className,
566
+ css: [Ce, I?.guide?.css],
567
+ children: [!B.length && b(k) && /* @__PURE__ */ m("span", { children: k }), b(O) && /* @__PURE__ */ m("span", { children: O })]
563
568
  })]
564
569
  }),
565
570
  /* @__PURE__ */ h("div", {
566
571
  "data-ui": "signature-pad-toolbar",
567
- className: F?.toolbar?.className,
568
- css: [Te, F?.toolbar?.css],
572
+ className: I?.toolbar?.className,
573
+ css: [we, I?.toolbar?.css],
569
574
  children: [
570
575
  /* @__PURE__ */ m(l, {
571
- "aria-label": N.ink,
576
+ "aria-label": P.ink,
572
577
  orientation: "horizontal",
573
- value: Ye,
574
- onValueChange: (e) => Xe(e),
575
- disabled: G,
578
+ value: Je,
579
+ onValueChange: (e) => Ye(e),
580
+ disabled: K,
576
581
  onKeyDown: dt,
577
- children: Object.keys(x).map((e) => /* @__PURE__ */ m(l.Radio, {
582
+ children: Object.keys(S).map((e) => /* @__PURE__ */ m(l.Radio, {
578
583
  value: e,
579
- label: N.colors[e]
584
+ label: P.colors[e]
580
585
  }, e))
581
586
  }),
582
587
  /* @__PURE__ */ m(l, {
583
- "aria-label": N.nib,
588
+ "aria-label": P.nib,
584
589
  orientation: "horizontal",
585
- value: Ze,
586
- onValueChange: (e) => Qe(e),
587
- disabled: G,
590
+ value: Xe,
591
+ onValueChange: (e) => Ze(e),
592
+ disabled: K,
588
593
  onKeyDown: dt,
589
- children: Object.keys(b).map((e) => /* @__PURE__ */ m(l.Radio, {
594
+ children: Object.keys(x).map((e) => /* @__PURE__ */ m(l.Radio, {
590
595
  value: e,
591
- label: N.widths[e]
596
+ label: P.widths[e]
592
597
  }, e))
593
598
  }),
594
599
  gt.map(({ action: e, disabled: t, run: n }) => /* @__PURE__ */ h(c, {
@@ -596,45 +601,45 @@ function M({ ref: e, apiRef: n, value: r, defaultValue: i = fe, onValueChange: s
596
601
  variant: "outline",
597
602
  disabled: t,
598
603
  onClick: n,
599
- className: F?.action?.className,
600
- css: F?.action?.css,
601
- children: [y(Ne?.[e]) && /* @__PURE__ */ m("span", {
604
+ className: I?.action?.className,
605
+ css: I?.action?.css,
606
+ children: [b(Me?.[e]) && /* @__PURE__ */ m("span", {
602
607
  "aria-hidden": "true",
603
- children: Ne?.[e]
604
- }), N.actions[e]]
608
+ children: Me?.[e]
609
+ }), P.actions[e]]
605
610
  }, e))
606
611
  ]
607
612
  }),
608
- M && /* @__PURE__ */ m("span", {
609
- id: `${L}-required`,
613
+ N && /* @__PURE__ */ m("span", {
614
+ id: `${R}-required`,
610
615
  css: o,
611
- children: N.required
616
+ children: P.required
612
617
  }),
613
- y(w) && /* @__PURE__ */ m("div", {
614
- id: `${L}-description`,
615
- className: F?.description?.className,
616
- css: [De, F?.description?.css],
617
- children: w
618
+ b(T) && /* @__PURE__ */ m("div", {
619
+ id: `${R}-description`,
620
+ className: I?.description?.className,
621
+ css: [Ee, I?.description?.css],
622
+ children: T
618
623
  }),
619
- y(T) && /* @__PURE__ */ m("div", {
620
- id: `${L}-error`,
624
+ b(E) && /* @__PURE__ */ m("div", {
625
+ id: `${R}-error`,
621
626
  role: "alert",
622
- className: F?.error?.className,
623
- css: [Oe, F?.error?.css],
624
- children: T
627
+ className: I?.error?.className,
628
+ css: [De, I?.error?.css],
629
+ children: E
625
630
  }),
626
631
  /* @__PURE__ */ m("div", {
627
632
  role: "status",
628
633
  "aria-live": "polite",
629
634
  "aria-atomic": "true",
630
- className: F?.status?.className,
631
- css: [o, F?.status?.css],
632
- children: et.text && /* @__PURE__ */ m("span", { children: et.text }, et.revision)
635
+ className: I?.status?.className,
636
+ css: [o, I?.status?.css],
637
+ children: $e.text && /* @__PURE__ */ m("span", { children: $e.text }, $e.revision)
633
638
  })
634
639
  ]
635
640
  })
636
641
  });
637
642
  }
638
- M.displayName = "SignaturePad";
643
+ N.displayName = "SignaturePad";
639
644
  //#endregion
640
- export { be as i, M as n, ye as r, S as t };
645
+ export { ye as i, N as n, ve as r, C as t };