jenosize-ui 0.2.2 → 0.3.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.
Files changed (221) hide show
  1. package/README.md +183 -63
  2. package/THIRD-PARTY-NOTICES.md +15 -0
  3. package/dist/GradientPicker-CQm3GT7F.d.ts +144 -0
  4. package/dist/{PaymentInput-Dn5WVQVy.d.ts → PaymentInput-Cz5jFB3p.d.ts} +1 -1
  5. package/dist/{Select-Dt5ARIH8.d.ts → Select-CXOAMlk7.d.ts} +15 -1
  6. package/dist/{TagInput-BaBeve6L.d.ts → TagInput-CzIrONr-.d.ts} +1 -1
  7. package/dist/area-chart.d.ts +2 -2
  8. package/dist/area-chart.js +7 -6
  9. package/dist/at-least-one-BZ2dsck-.d.ts +18 -0
  10. package/dist/avatar.d.ts +1 -1
  11. package/dist/avatar.js +11 -10
  12. package/dist/badge.d.ts +1 -1
  13. package/dist/badge.js +6 -6
  14. package/dist/bar-chart.d.ts +2 -2
  15. package/dist/bar-chart.js +7 -6
  16. package/dist/breadcrumb.d.ts +1 -1
  17. package/dist/breadcrumb.js +4 -4
  18. package/dist/button.d.ts +1 -1
  19. package/dist/button.js +11 -10
  20. package/dist/calendar.d.ts +1 -1
  21. package/dist/calendar.js +15 -14
  22. package/dist/callout.d.ts +4 -2
  23. package/dist/callout.js +12 -11
  24. package/dist/card.d.ts +59 -3
  25. package/dist/card.js +3 -3
  26. package/dist/carousel.d.ts +169 -0
  27. package/dist/carousel.js +9 -0
  28. package/dist/catalog.json +11180 -0
  29. package/dist/checkbox.js +8 -7
  30. package/dist/{chunk-R4Z7BINC.js → chunk-26XQU3TC.js} +8 -8
  31. package/dist/{chunk-AIARANKE.js → chunk-3JQKVC2K.js} +4 -4
  32. package/dist/chunk-3P3QZPHV.js +109 -0
  33. package/dist/{chunk-GLKFFA7N.js → chunk-44AWXIQK.js} +5 -5
  34. package/dist/{chunk-FWRHBMWT.js → chunk-4Y32RIC7.js} +5 -19
  35. package/dist/{chunk-5XPMY2LF.js → chunk-5ECTNYKU.js} +5 -5
  36. package/dist/{chunk-ZD3MOLIB.js → chunk-5GBA6X6A.js} +4 -4
  37. package/dist/{chunk-LE44X5GS.js → chunk-5SGF47TZ.js} +9 -9
  38. package/dist/{chunk-POQTE7JI.js → chunk-5XSR757T.js} +7 -7
  39. package/dist/{chunk-3HOHLQVP.js → chunk-6FGLABYH.js} +3 -3
  40. package/dist/{chunk-MCQG4H6T.js → chunk-6T3QAO5K.js} +12 -4
  41. package/dist/{chunk-SKRR3ZMP.js → chunk-737A4YNC.js} +3 -3
  42. package/dist/{chunk-AFYXSZGW.js → chunk-7LSUUEAF.js} +7 -5
  43. package/dist/{chunk-7VLYQR4D.js → chunk-7OFGPDYJ.js} +3 -3
  44. package/dist/{chunk-54SIZR63.js → chunk-7UCKFULR.js} +7 -7
  45. package/dist/{chunk-LQURV7HQ.js → chunk-7ZA3QZRP.js} +4 -4
  46. package/dist/{chunk-X2VMIBK5.js → chunk-A4YPUS6C.js} +4 -4
  47. package/dist/{chunk-5ZEUTSCV.js → chunk-B4OVIE2X.js} +6 -6
  48. package/dist/{chunk-P6CON2R2.js → chunk-BH32X25C.js} +3 -3
  49. package/dist/{chunk-7QXOGAN6.js → chunk-BJHLW25G.js} +85 -538
  50. package/dist/{chunk-ULGCGKOE.js → chunk-BKBINQJZ.js} +4 -4
  51. package/dist/{chunk-CFFWYXDW.js → chunk-BXQFBFT7.js} +5 -5
  52. package/dist/{chunk-I6WMNXC7.js → chunk-CQGMOPLG.js} +6 -6
  53. package/dist/{chunk-FNQJJO63.js → chunk-CUONE6LA.js} +4 -4
  54. package/dist/{chunk-D6XO4JVM.js → chunk-CVCS5G3E.js} +42 -20
  55. package/dist/{chunk-33TOK7ES.js → chunk-DCKVNHV5.js} +5 -5
  56. package/dist/{chunk-ZR6HNKSN.js → chunk-DYRGHXT5.js} +3 -3
  57. package/dist/{chunk-T4ZFZTY6.js → chunk-EHML2DLR.js} +4 -4
  58. package/dist/{chunk-N3RVMBPX.js → chunk-EJKQGUUM.js} +4 -4
  59. package/dist/{chunk-E2YZ7IMT.js → chunk-ESDSTS5N.js} +6 -6
  60. package/dist/{chunk-LCG34A5T.js → chunk-EVINS473.js} +5 -3
  61. package/dist/chunk-EXRVOGJ5.js +325 -0
  62. package/dist/{chunk-YHBI52P2.js → chunk-GDW6NFYN.js} +3 -3
  63. package/dist/chunk-GOCO45FF.js +619 -0
  64. package/dist/{chunk-7ZM7SNCZ.js → chunk-GPHGPY6T.js} +3 -3
  65. package/dist/{chunk-CGZXQ7PA.js → chunk-HNNNJP3A.js} +3 -3
  66. package/dist/{chunk-ZZSNTCCL.js → chunk-IESEBPYA.js} +4 -4
  67. package/dist/{chunk-74AIU53R.js → chunk-JZ4HGFWK.js} +3 -3
  68. package/dist/chunk-KBQJIVUB.js +33 -0
  69. package/dist/{chunk-QNIKRB62.js → chunk-KCM4KEZ2.js} +4 -4
  70. package/dist/{chunk-3QXLIZIX.js → chunk-KNGJ3CSB.js} +3 -3
  71. package/dist/{chunk-5YWH2ANQ.js → chunk-KNW3IUWX.js} +11 -10
  72. package/dist/{chunk-KZP6B6B3.js → chunk-KTWTYK5U.js} +16 -5
  73. package/dist/{chunk-LYXPJERB.js → chunk-L7Z6XGBU.js} +5 -5
  74. package/dist/{chunk-TX57TNJS.js → chunk-LLUWBQK6.js} +9 -9
  75. package/dist/{chunk-NC63TYNW.js → chunk-MDKVYC6R.js} +7 -7
  76. package/dist/{chunk-22M75A3N.js → chunk-MS6DY4CE.js} +14 -11
  77. package/dist/{chunk-LLPWQDF7.js → chunk-MTOTPAYZ.js} +3 -3
  78. package/dist/{chunk-AZ7DKRBY.js → chunk-MVF7FA4D.js} +5 -5
  79. package/dist/{chunk-AIGYMTCU.js → chunk-MVUNB43J.js} +3 -3
  80. package/dist/{chunk-UGBNYSBN.js → chunk-O24HHIQG.js} +20 -34
  81. package/dist/{chunk-NKG4N6HA.js → chunk-O5EHNNPS.js} +4 -4
  82. package/dist/{chunk-5DP7W5HX.js → chunk-OIPFTJS6.js} +3 -3
  83. package/dist/{chunk-DD5KJVFV.js → chunk-OXNIEIOY.js} +19 -19
  84. package/dist/chunk-P2BGR77C.js +344 -0
  85. package/dist/{chunk-CGHYXWTT.js → chunk-PFAFTLN3.js} +4 -4
  86. package/dist/{chunk-4RBIWI2Q.js → chunk-Q2KR7PSX.js} +3 -3
  87. package/dist/{chunk-7GUPNTAH.js → chunk-QSOLK2I2.js} +7 -7
  88. package/dist/chunk-QTWRR7IS.js +1129 -0
  89. package/dist/{chunk-OLLD2BZN.js → chunk-QZHAL4BL.js} +3 -3
  90. package/dist/{chunk-OACWA4TC.js → chunk-R25NHHYT.js} +6 -6
  91. package/dist/{chunk-QDKETK7D.js → chunk-S55JKMG7.js} +5 -5
  92. package/dist/{chunk-HV2W6HUR.js → chunk-S5LLA36K.js} +10 -10
  93. package/dist/{chunk-QDYE5LVT.js → chunk-SF3HCW4G.js} +45 -4
  94. package/dist/{chunk-KHGW72BM.js → chunk-SGMVB7HD.js} +3 -3
  95. package/dist/chunk-SKPKL47Y.js +5671 -0
  96. package/dist/{chunk-6MMBQVRO.js → chunk-TCTTZHUS.js} +9 -9
  97. package/dist/chunk-U5X3MLM5.js +67 -0
  98. package/dist/chunk-UHSGD4CD.js +364 -0
  99. package/dist/chunk-UJ4WEQHR.js +525 -0
  100. package/dist/{chunk-IEAWNA3V.js → chunk-VDFWWWLL.js} +3 -3
  101. package/dist/{chunk-5KSD4WKN.js → chunk-VIKV25VP.js} +5 -5
  102. package/dist/chunk-WJB5GWAZ.js +20 -0
  103. package/dist/{chunk-HHYEAFCL.js → chunk-XAQQ4LYL.js} +11 -11
  104. package/dist/{chunk-KJ5JUS53.js → chunk-XCFFM2C7.js} +9 -9
  105. package/dist/chunk-XKTD3X6Z.js +183 -0
  106. package/dist/{chunk-GQRSABRN.js → chunk-XWXXKEG6.js} +4 -4
  107. package/dist/chunk-YGFTNICV.js +110 -0
  108. package/dist/{chunk-T5574MXM.js → chunk-YGJL7QS7.js} +8 -8
  109. package/dist/{chunk-SB3DG572.js → chunk-YKPTUANT.js} +6 -6
  110. package/dist/{chunk-YPNL2NBD.js → chunk-YQAYAJ2T.js} +33 -11
  111. package/dist/chunk-YXYZW6WU.js +998 -0
  112. package/dist/{chunk-IQNVSQRK.js → chunk-Z6NSOC6T.js} +5 -5
  113. package/dist/{chunk-BBKE4W3B.js → chunk-ZAWGG4H2.js} +7 -7
  114. package/dist/{chunk-MFFA5MXY.js → chunk-ZF362B2X.js} +5 -5
  115. package/dist/{chunk-RJTVCA62.js → chunk-ZJIY642R.js} +3 -3
  116. package/dist/color-input.d.ts +93 -0
  117. package/dist/color-input.js +35 -0
  118. package/dist/color-picker.d.ts +268 -0
  119. package/dist/color-picker.js +28 -0
  120. package/dist/color-value-DYzChVOW.d.ts +129 -0
  121. package/dist/combobox.d.ts +1 -1
  122. package/dist/combobox.js +13 -12
  123. package/dist/date-calendar.d.ts +49 -0
  124. package/dist/date-calendar.js +12 -0
  125. package/dist/date-input.d.ts +1 -1
  126. package/dist/date-input.js +11 -10
  127. package/dist/date-picker.d.ts +15 -131
  128. package/dist/date-picker.js +25 -21
  129. package/dist/date-types-DrDdF6WJ.d.ts +100 -0
  130. package/dist/dialog.d.ts +1 -1
  131. package/dist/dialog.js +9 -9
  132. package/dist/drawer.d.ts +1 -1
  133. package/dist/drawer.js +8 -8
  134. package/dist/dropdown-menu.d.ts +1 -1
  135. package/dist/dropdown-menu.js +4 -4
  136. package/dist/dropzone.d.ts +3 -3
  137. package/dist/dropzone.js +17 -16
  138. package/dist/form.d.ts +15 -5
  139. package/dist/form.js +74 -35
  140. package/dist/header-navigation.d.ts +2 -2
  141. package/dist/header-navigation.js +19 -18
  142. package/dist/helper.d.ts +1 -1
  143. package/dist/index.d.ts +25 -11
  144. package/dist/index.js +90 -77
  145. package/dist/indicator.js +4 -4
  146. package/dist/inline-banner.d.ts +68 -0
  147. package/dist/inline-banner.js +20 -0
  148. package/dist/input.d.ts +1 -1
  149. package/dist/input.js +10 -9
  150. package/dist/kanban-board.d.ts +2 -2
  151. package/dist/kanban-board.js +14 -13
  152. package/dist/labels-C992bt7G.d.ts +1160 -0
  153. package/dist/line-chart.d.ts +2 -2
  154. package/dist/line-chart.js +7 -6
  155. package/dist/mcp.js +231 -0
  156. package/dist/number-input.d.ts +1 -1
  157. package/dist/number-input.js +10 -9
  158. package/dist/pagination.d.ts +1 -1
  159. package/dist/pagination.js +14 -13
  160. package/dist/{card-D56VxyAe.d.ts → panel-CUGm_Mxy.d.ts} +9 -57
  161. package/dist/payment-input.d.ts +3 -3
  162. package/dist/payment-input.js +10 -9
  163. package/dist/picker-draft-BPV3MUPY.d.ts +9 -0
  164. package/dist/pie-chart.d.ts +2 -2
  165. package/dist/pie-chart.js +7 -6
  166. package/dist/popover.d.ts +65 -4
  167. package/dist/popover.js +8 -8
  168. package/dist/progress-steps.js +4 -4
  169. package/dist/progress.js +3 -3
  170. package/dist/provider.d.ts +1 -1
  171. package/dist/provider.js +3 -3
  172. package/dist/qr-code.d.ts +227 -0
  173. package/dist/qr-code.js +19 -0
  174. package/dist/radar-chart.d.ts +2 -2
  175. package/dist/radar-chart.js +7 -6
  176. package/dist/radial-chart.d.ts +2 -2
  177. package/dist/radial-chart.js +7 -6
  178. package/dist/radio.js +8 -7
  179. package/dist/rich-text-editor.d.ts +624 -0
  180. package/dist/rich-text-editor.js +51 -0
  181. package/dist/rich-text-highlight.d.ts +11 -0
  182. package/dist/rich-text-highlight.js +65 -0
  183. package/dist/rich-text-sanitize.d.ts +17 -0
  184. package/dist/rich-text-sanitize.js +176 -0
  185. package/dist/select.d.ts +2 -2
  186. package/dist/select.js +16 -15
  187. package/dist/separator.js +2 -2
  188. package/dist/shared-CGf2D8ZX.d.ts +20 -0
  189. package/dist/sidebar-navigation.d.ts +73 -32
  190. package/dist/sidebar-navigation.js +14 -13
  191. package/dist/sidebar-state.d.ts +76 -0
  192. package/dist/sidebar-state.js +27 -0
  193. package/dist/skeleton.js +2 -2
  194. package/dist/slider.d.ts +321 -0
  195. package/dist/slider.js +13 -0
  196. package/dist/styles.css +1 -1
  197. package/dist/switch.d.ts +1 -1
  198. package/dist/switch.js +2 -2
  199. package/dist/table.d.ts +3 -19
  200. package/dist/table.js +33 -32
  201. package/dist/tabs.js +2 -2
  202. package/dist/tag-input.d.ts +3 -3
  203. package/dist/tag-input.js +13 -12
  204. package/dist/tag.d.ts +1 -1
  205. package/dist/tag.js +4 -4
  206. package/dist/textarea.js +8 -7
  207. package/dist/theme.css +965 -0
  208. package/dist/theme.js +12 -11
  209. package/dist/toast.d.ts +1 -1
  210. package/dist/toast.js +12 -11
  211. package/dist/tooltip.js +4 -3
  212. package/dist/tree.d.ts +1 -1
  213. package/dist/tree.js +6 -6
  214. package/dist/{types-DR9rAEy1.d.ts → types-DYFl0CEB.d.ts} +1 -1
  215. package/dist/{use-uploads-KaPqDklo.d.ts → use-uploads-2E7n0PWT.d.ts} +1 -1
  216. package/dist/verification-code-input.js +10 -9
  217. package/package.json +92 -8
  218. package/dist/chunk-BLIZ3CL3.js +0 -49
  219. package/dist/labels-DPrh0se9.d.ts +0 -627
  220. package/dist/panel-El4oI68p.d.ts +0 -9
  221. package/dist/shared-BYXJPnsN.d.ts +0 -11
@@ -0,0 +1,525 @@
1
+ import { relativeLuminance, BLACK, parseColor } from './chunk-UHSGD4CD.js';
2
+ import { Button } from './chunk-R25NHHYT.js';
3
+ import { DownloadIcon } from './chunk-YGFTNICV.js';
4
+ import { cn } from './chunk-ZSNJ6UA3.js';
5
+ import { useLabels } from './chunk-ZJIY642R.js';
6
+ import { warnPositiveInt, devWarn, warnAspectOverflow } from './chunk-SF3HCW4G.js';
7
+ import * as React from 'react';
8
+ import { QrCodeDataType, encode } from 'uqr';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+
11
+ // src/lib/download.ts
12
+ function serializeSvg(svg, pixelSize) {
13
+ const clone = svg.cloneNode(true);
14
+ if (pixelSize !== void 0) {
15
+ clone.setAttribute("width", String(pixelSize));
16
+ clone.setAttribute("height", String(pixelSize));
17
+ }
18
+ clone.removeAttribute("class");
19
+ for (const el of clone.querySelectorAll("[class]")) el.removeAttribute("class");
20
+ for (const el of [clone, ...clone.querySelectorAll("[aria-labelledby]")]) {
21
+ const ids = el.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean) ?? [];
22
+ if (ids.length > 0 && ids.every((id) => clone.querySelector(`[id="${CSS.escape(id)}"]`) === null)) {
23
+ el.removeAttribute("aria-labelledby");
24
+ }
25
+ }
26
+ const markup = new XMLSerializer().serializeToString(clone);
27
+ return markup.includes('xmlns="http://www.w3.org/2000/svg"') ? markup : markup.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"');
28
+ }
29
+ async function rasterizeSvgMarkup(markup, pixelSize) {
30
+ const source = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`;
31
+ const img = new Image();
32
+ img.src = source;
33
+ await img.decode();
34
+ const canvas = document.createElement("canvas");
35
+ canvas.width = pixelSize;
36
+ canvas.height = pixelSize;
37
+ const ctx = canvas.getContext("2d");
38
+ if (ctx === null) throw new Error("rasterizeSvgMarkup: no 2D canvas context.");
39
+ ctx.imageSmoothingEnabled = false;
40
+ ctx.drawImage(img, 0, 0, pixelSize, pixelSize);
41
+ return await new Promise((resolve, reject) => {
42
+ canvas.toBlob((blob) => blob === null ? reject(new Error("rasterizeSvgMarkup: toBlob returned null.")) : resolve(blob), "image/png");
43
+ });
44
+ }
45
+ async function svgToPngBlob(svg, pixelSize) {
46
+ return await rasterizeSvgMarkup(serializeSvg(svg, pixelSize), pixelSize);
47
+ }
48
+ function saveBlob(blob, fileName) {
49
+ const url = URL.createObjectURL(blob);
50
+ const anchor = document.createElement("a");
51
+ anchor.href = url;
52
+ anchor.download = fileName;
53
+ anchor.rel = "noopener";
54
+ document.body.append(anchor);
55
+ anchor.click();
56
+ anchor.remove();
57
+ setTimeout(() => URL.revokeObjectURL(url), 0);
58
+ }
59
+ var QUIET_ZONE = 4;
60
+ var EYE_SIZE = 7;
61
+ var LOGO_FRACTION = { sm: 0.18, md: 0.24, lg: 0.28 };
62
+ var DEFAULT_LOGO_SIZE = "md";
63
+ var DEFAULT_LOGO_SHAPE = "square";
64
+ var LOGO_BLEED = 1;
65
+ var LOGO_GRID = 24;
66
+ var LOGO_ASPECT_MIN = 0.5;
67
+ var LOGO_ASPECT_MAX = 2;
68
+ var LOGO_SHAPE_RADIUS = { square: 0, circle: 0.5 };
69
+ var MODULE_SHAPE = {
70
+ square: { size: 1, radius: 0 },
71
+ rounded: { size: 0.85, radius: 0.25 },
72
+ dot: { size: 1, radius: 0.5 }
73
+ };
74
+ var EYE_RADIUS = { square: 0, rounded: 2, circle: 3.5 };
75
+ var DEFAULT_QR_COLOR = "#000000";
76
+ var MIN_SYMBOL_CONTRAST = 0.45;
77
+ var LOCATOR_TYPES = /* @__PURE__ */ new Set([QrCodeDataType.Position, QrCodeDataType.Timing, QrCodeDataType.Function]);
78
+ var EMPTY = {
79
+ extent: 21 + QUIET_ZONE * 2,
80
+ path: "",
81
+ eyePath: "",
82
+ pupilPath: "",
83
+ hole: null,
84
+ logoBox: null,
85
+ logoTransform: null,
86
+ holeCoversLocator: false,
87
+ budgetExceeded: false,
88
+ unencodable: true
89
+ };
90
+ function buildQrGeometry(value, options = {}) {
91
+ if (value === "") {
92
+ devWarn("<QrCode> `value` is empty \u2014 there is nothing to encode. Render the code once you have a value.");
93
+ return EMPTY;
94
+ }
95
+ const ecc = options.ecc ?? "H";
96
+ const moduleShape = options.modules ?? "square";
97
+ const eyeShape = options.eyes ?? "square";
98
+ const rawAspect = options.logoAspect ?? null;
99
+ let result;
100
+ try {
101
+ result = encode(value, { ecc, border: QUIET_ZONE });
102
+ } catch {
103
+ devWarn(`<QrCode> \`value\` is too long to encode at error correction level "${ecc}" (${value.length} chars). Shorten it, or lower \`ecc\`.`);
104
+ return EMPTY;
105
+ }
106
+ let aspect = rawAspect === null ? null : clampAspect(rawAspect);
107
+ if (aspect !== null && (ecc === "L" || ecc === "M")) {
108
+ devWarn(
109
+ `<QrCode> \`ecc="${ecc}"\` cannot carry a \`logo\`, so the mark was DROPPED and the bare code rendered. The mark erases part of the code, and that erasure comes out of the same budget the level buys \u2014 level ${ecc} recovers ~${ecc === "L" ? 7 : 15}%, which a centre mark alone exhausts, and the failure is silent: the code renders perfectly and simply does not decode. Use "Q" or "H" (the default) whenever there is a mark.`
110
+ );
111
+ aspect = null;
112
+ }
113
+ const { size, data, types } = result;
114
+ const logoSize = options.logoSize ?? DEFAULT_LOGO_SIZE;
115
+ const logoShape = options.logoShape ?? DEFAULT_LOGO_SHAPE;
116
+ const hole = aspect === null ? null : centredHole(size, aspect, logoSize, logoShape);
117
+ const drawEyes = moduleShape !== "square" || eyeShape !== "square" || options.tintedEyes === true;
118
+ const box = hole === null || aspect === null ? null : markBox(hole, aspect);
119
+ const spend = hole === null ? null : codewordBudget(value, options);
120
+ return {
121
+ extent: size,
122
+ path: modulesToPath(data, types, hole, moduleShape, drawEyes),
123
+ eyePath: drawEyes ? eyeRingPath(size, eyeShape) : "",
124
+ pupilPath: drawEyes ? eyePupilPath(size, eyeShape) : "",
125
+ hole,
126
+ logoBox: box,
127
+ logoTransform: box === null ? null : `translate(${n(box.x)} ${n(box.y)}) scale(${box.h / LOGO_GRID})`,
128
+ holeCoversLocator: hole !== null && coversLocatorPattern(types, hole),
129
+ budgetExceeded: spend !== null && spend.destroyed > spend.budget,
130
+ unencodable: false
131
+ };
132
+ }
133
+ var ECC_BUDGET = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
134
+ function codewordBudget(value, options = {}) {
135
+ if (value === "") return null;
136
+ const ecc = options.ecc ?? "H";
137
+ let result;
138
+ try {
139
+ result = encode(value, { ecc, border: QUIET_ZONE });
140
+ } catch {
141
+ return null;
142
+ }
143
+ const { size, types } = result;
144
+ const aspect = options.logoAspect ?? null;
145
+ const hole = aspect === null ? null : centredHole(
146
+ size,
147
+ Math.min(LOGO_ASPECT_MAX, Math.max(LOGO_ASPECT_MIN, aspect)),
148
+ options.logoSize ?? DEFAULT_LOGO_SIZE,
149
+ options.logoShape ?? DEFAULT_LOGO_SHAPE
150
+ );
151
+ const code = size - QUIET_ZONE * 2;
152
+ const destroyed = /* @__PURE__ */ new Set();
153
+ let bit = 0;
154
+ let upward = true;
155
+ for (let col = code - 1; col > 0; col -= 2) {
156
+ if (col === 6) col -= 1;
157
+ for (let i = 0; i < code; i++) {
158
+ const row = upward ? code - 1 - i : i;
159
+ for (const c of [col, col - 1]) {
160
+ const ir = row + QUIET_ZONE;
161
+ const ic = c + QUIET_ZONE;
162
+ if (types[ir]?.[ic] === QrCodeDataType.Data) {
163
+ if (inHole(hole, ir, ic)) destroyed.add(bit >> 3);
164
+ bit += 1;
165
+ }
166
+ }
167
+ }
168
+ upward = !upward;
169
+ }
170
+ const total = bit >> 3;
171
+ return { destroyed: destroyed.size, budget: Math.floor(total * ECC_BUDGET[ecc]) };
172
+ }
173
+ var HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
174
+ function relativeLuminance2(hex) {
175
+ return relativeLuminance(parseColor(hex) ?? BLACK);
176
+ }
177
+ function symbolContrast(hex) {
178
+ return 1 - relativeLuminance2(hex);
179
+ }
180
+ function resolveQrColor(color, prop = "color") {
181
+ if (color === void 0) return DEFAULT_QR_COLOR;
182
+ if (!HEX.test(color)) {
183
+ devWarn(
184
+ `<QrCode> \`${prop}\` must be a 3- or 6-digit hex like "#06C755" \u2014 got "${color}". Falling back to ${DEFAULT_QR_COLOR}. An alpha channel is rejected too: a translucent module composites against whatever sits behind the plate, and a scanner has no way to threshold that.`
185
+ );
186
+ return DEFAULT_QR_COLOR;
187
+ }
188
+ const contrast = symbolContrast(color);
189
+ if (contrast < MIN_SYMBOL_CONTRAST) {
190
+ devWarn(
191
+ `<QrCode> \`${prop}="${color}"\` has ${(contrast * 100).toFixed(0)}% symbol contrast against the white plate, below the ${MIN_SYMBOL_CONTRAST * 100}% ISO/IEC 15415 wants for a printed symbol. It will still decode from a screen; what it loses is the margin a camera needs at an angle, under warm light, or on a matte label. Darken it. For reference, LINE's brand green (#06C755) measures 59%.`
192
+ );
193
+ }
194
+ return color;
195
+ }
196
+ function shapeRenderingFor(modules = "square", eyes = "square") {
197
+ return modules === "square" && eyes === "square" ? "crispEdges" : "geometricPrecision";
198
+ }
199
+ function n(value) {
200
+ return String(Math.round(value * 1e4) / 1e4);
201
+ }
202
+ function roundedRectPath(x, y, w, h, r) {
203
+ const rr = Math.min(r, w / 2, h / 2);
204
+ if (rr <= 0) return `M${n(x)} ${n(y)}h${n(w)}v${n(h)}h${n(-w)}z`;
205
+ const side = w - rr * 2;
206
+ const rise = h - rr * 2;
207
+ const arc = `a${n(rr)} ${n(rr)} 0 0 1 `;
208
+ return `M${n(x + rr)} ${n(y)}h${n(side)}${arc}${n(rr)} ${n(rr)}v${n(rise)}${arc}${n(-rr)} ${n(rr)}h${n(-side)}${arc}${n(-rr)} ${n(-rr)}v${n(-rise)}${arc}${n(rr)} ${n(-rr)}z`;
209
+ }
210
+ function centredHole(extent, aspect, size, shape) {
211
+ let inner = Math.round((extent - QUIET_ZONE * 2) * LOGO_FRACTION[size]);
212
+ if (inner % 2 === 0) inner += 1;
213
+ const area = inner * inner;
214
+ const wi0 = oddify(Math.sqrt(area * aspect));
215
+ const hi0 = oddBelow(area / wi0);
216
+ const fitH = Math.min(hi0, wi0 / aspect);
217
+ const wi = Math.min(wi0, oddAtLeast(fitH * aspect));
218
+ const hi = Math.min(hi0, oddAtLeast(fitH));
219
+ const w = wi + LOGO_BLEED * 2;
220
+ const h = hi + LOGO_BLEED * 2;
221
+ return { x: (extent - w) / 2, y: (extent - h) / 2, w, h, r: Math.min(w, h) * LOGO_SHAPE_RADIUS[shape] };
222
+ }
223
+ function oddify(value) {
224
+ return Math.max(1, 2 * Math.round((value - 1) / 2) + 1);
225
+ }
226
+ function oddBelow(value) {
227
+ const floored = Math.floor(value);
228
+ return Math.max(1, floored % 2 === 0 ? floored - 1 : floored);
229
+ }
230
+ function oddAtLeast(value) {
231
+ const ceiled = Math.ceil(value);
232
+ return Math.max(1, ceiled % 2 === 0 ? ceiled + 1 : ceiled);
233
+ }
234
+ function clampAspect(aspect) {
235
+ if (!Number.isFinite(aspect) || aspect <= 0) {
236
+ devWarn(`<QrCode> \`logo.aspect\` must be a positive number \u2014 got ${aspect}. Falling back to 1 (a square mark).`);
237
+ return 1;
238
+ }
239
+ if (aspect < LOGO_ASPECT_MIN || aspect > LOGO_ASPECT_MAX) {
240
+ const clamped = Math.min(LOGO_ASPECT_MAX, Math.max(LOGO_ASPECT_MIN, aspect));
241
+ devWarn(
242
+ `<QrCode> \`logo.aspect\` is ${aspect}, outside the ${LOGO_ASPECT_MIN}\u2013${LOGO_ASPECT_MAX} a code can carry \u2014 clamped to ${clamped}. The hole holds its area as it widens, but a codeword is taller than it is wide, so a wider hole still destroys more of them: past 2 a version-3 code at level H is over its recovery budget.`
243
+ );
244
+ return clamped;
245
+ }
246
+ return aspect;
247
+ }
248
+ function markBox(hole, aspect) {
249
+ const availW = hole.w - LOGO_BLEED * 2;
250
+ const availH = hole.h - LOGO_BLEED * 2;
251
+ const h = Math.min(availH, availW / aspect);
252
+ const w = h * aspect;
253
+ return { x: hole.x + (hole.w - w) / 2, y: hole.y + (hole.h - h) / 2, w, h };
254
+ }
255
+ function insideRoundedRect(hole, px, py) {
256
+ if (px < hole.x || px > hole.x + hole.w || py < hole.y || py > hole.y + hole.h) return false;
257
+ const rr = Math.min(hole.r, hole.w / 2, hole.h / 2);
258
+ if (rr <= 0) return true;
259
+ const dx = Math.max(hole.x + rr - px, px - (hole.x + hole.w - rr), 0);
260
+ const dy = Math.max(hole.y + rr - py, py - (hole.y + hole.h - rr), 0);
261
+ return dx * dx + dy * dy <= rr * rr;
262
+ }
263
+ function inHole(hole, r, c) {
264
+ if (hole === null) return false;
265
+ return insideRoundedRect(hole, c + 0.5, r + 0.5);
266
+ }
267
+ function modulesToPath(data, types, hole, shape, styledEyes) {
268
+ const { size, radius } = MODULE_SHAPE[shape];
269
+ const inset = (1 - size) / 2;
270
+ const parts = [];
271
+ for (const [r, row] of data.entries()) {
272
+ let run = 0;
273
+ for (let c = 0; c <= row.length; c++) {
274
+ const dark = row[c] === true && !inHole(hole, r, c) && !(styledEyes && types[r]?.[c] === QrCodeDataType.Position);
275
+ if (shape === "square") {
276
+ if (dark) {
277
+ run += 1;
278
+ } else if (run > 0) {
279
+ parts.push(`M${c - run} ${r}h${run}v1h-${run}z`);
280
+ run = 0;
281
+ }
282
+ } else if (dark) {
283
+ parts.push(roundedRectPath(c + inset, r + inset, size, size, size * radius));
284
+ }
285
+ }
286
+ }
287
+ return parts.join("");
288
+ }
289
+ function eyeOrigins(extent) {
290
+ const far = extent - QUIET_ZONE - EYE_SIZE;
291
+ return [
292
+ [QUIET_ZONE, QUIET_ZONE],
293
+ [far, QUIET_ZONE],
294
+ [QUIET_ZONE, far]
295
+ ];
296
+ }
297
+ function eyeRingPath(extent, shape) {
298
+ const outer = EYE_RADIUS[shape];
299
+ return eyeOrigins(extent).map(
300
+ ([x, y]) => (
301
+ // `outer − 1` keeps the ring exactly one module thick all the way round. It falls out to 0 when
302
+ // the outer radius does.
303
+ roundedRectPath(x, y, EYE_SIZE, EYE_SIZE, outer) + roundedRectPath(x + 1, y + 1, 5, 5, Math.max(0, outer - 1))
304
+ )
305
+ ).join("");
306
+ }
307
+ function eyePupilPath(extent, shape) {
308
+ const outer = EYE_RADIUS[shape];
309
+ return eyeOrigins(extent).map(([x, y]) => roundedRectPath(x + 2, y + 2, 3, 3, outer * 3 / EYE_SIZE)).join("");
310
+ }
311
+ function coversLocatorPattern(types, hole) {
312
+ for (let r = hole.y; r < hole.y + hole.h; r++) {
313
+ for (let c = hole.x; c < hole.x + hole.w; c++) {
314
+ const type = types[r]?.[c];
315
+ if (type !== void 0 && LOCATOR_TYPES.has(type) && inHole(hole, r, c)) return true;
316
+ }
317
+ }
318
+ return false;
319
+ }
320
+
321
+ // src/components/qr-code/labels.ts
322
+ var QR_CODE_LABELS = {
323
+ /** The `sr-only` text the `role="img"` svg is named by. */
324
+ name: (ctx) => `QR code for ${ctx.value}`,
325
+ /** Shown in place of the name when `value` did not encode. */
326
+ unavailable: "QR code unavailable",
327
+ downloadPng: "Download PNG",
328
+ downloadSvg: "Download SVG"
329
+ };
330
+ var DEFAULT_PIXEL_SIZE = 1024;
331
+ var DEFAULT_FILE_NAME = "qr-code";
332
+ var DEFAULT_FORMATS = ["png"];
333
+ var DOWNLOAD_LABEL = { png: "downloadPng", svg: "downloadSvg" };
334
+ function readLogo(logo) {
335
+ if (!logo) return null;
336
+ if (typeof logo === "object" && !React.isValidElement(logo) && "node" in logo) {
337
+ return { node: logo.node, aspect: logo.aspect ?? 1, size: logo.size ?? "md", shape: logo.shape ?? "square" };
338
+ }
339
+ return { node: logo, aspect: 1, size: "md", shape: "square" };
340
+ }
341
+ function QrCode({
342
+ value,
343
+ ecc = "H",
344
+ logo,
345
+ color,
346
+ eyeColor,
347
+ pupilColor,
348
+ modules = "square",
349
+ eyes = "square",
350
+ download = false,
351
+ "aria-label": ariaLabel,
352
+ labels,
353
+ className
354
+ }) {
355
+ const t = useLabels("qrCode", QR_CODE_LABELS, labels);
356
+ const nameId = React.useId();
357
+ const svgRef = React.useRef(null);
358
+ const logoRef = React.useRef(null);
359
+ const [rasterizing, setRasterizing] = React.useState(false);
360
+ const mark = readLogo(logo);
361
+ const logoAspect = mark?.aspect ?? null;
362
+ const logoSize = mark?.size ?? "md";
363
+ const logoShape = mark?.shape ?? "square";
364
+ const dark = React.useMemo(() => resolveQrColor(color), [color]);
365
+ const ring = React.useMemo(() => eyeColor === void 0 ? dark : resolveQrColor(eyeColor, "eyeColor"), [eyeColor, dark]);
366
+ const pupil = React.useMemo(() => pupilColor === void 0 ? ring : resolveQrColor(pupilColor, "pupilColor"), [pupilColor, ring]);
367
+ const tintedEyes = ring !== dark || pupil !== ring;
368
+ const geometry = React.useMemo(
369
+ () => buildQrGeometry(value, { ecc, modules, eyes, logoAspect, logoSize, logoShape, tintedEyes }),
370
+ [value, ecc, modules, eyes, logoAspect, logoSize, logoShape, tintedEyes]
371
+ );
372
+ const options = download === false ? null : download;
373
+ const fileName = options?.fileName ?? DEFAULT_FILE_NAME;
374
+ const formats = options?.formats ?? DEFAULT_FORMATS;
375
+ const pixelSize = options?.pixelSize ?? DEFAULT_PIXEL_SIZE;
376
+ warnPositiveInt("QrCode", "download.pixelSize", options?.pixelSize);
377
+ React.useEffect(() => {
378
+ if (geometry.holeCoversLocator) {
379
+ devWarn(
380
+ "<QrCode> the `logo` covers a finder, timing or format pattern. Those are read BEFORE error correction exists, so no `ecc` recovers them and the code will not scan. This code is too small to carry a centre mark \u2014 drop the `logo`, or encode a longer `value`."
381
+ );
382
+ }
383
+ }, [geometry.holeCoversLocator]);
384
+ React.useEffect(() => {
385
+ if (geometry.budgetExceeded && !geometry.holeCoversLocator) {
386
+ devWarn(
387
+ "<QrCode> the `logo` erases more of the code than `ecc` can recover, so the mark has spent the whole damage budget before the first scuff or bad angle. It may still decode from a clean screen and fail off a printed label. Three fixes, in order of how much they buy: a smaller `logo.size`, a longer `value` (a denser code has more codewords to spend), or a squarer `logo.aspect` \u2014 a wide mark shreds more codewords than a square one covering the same area."
388
+ );
389
+ }
390
+ }, [geometry.budgetExceeded, geometry.holeCoversLocator]);
391
+ React.useLayoutEffect(() => {
392
+ const g = logoRef.current;
393
+ const svg = svgRef.current;
394
+ const box = geometry.logoBox;
395
+ const base = geometry.logoTransform;
396
+ if (g === null || svg === null || box === null || base === null) return;
397
+ g.setAttribute("transform", base);
398
+ const frame = svg.getBoundingClientRect();
399
+ if (frame.width === 0) return;
400
+ const per = frame.width / geometry.extent;
401
+ const ink = g.getBoundingClientRect();
402
+ if (ink.width === 0 || ink.height === 0) return;
403
+ const inkW = ink.width / per;
404
+ const inkH = ink.height / per;
405
+ const fit = Math.min(box.w / inkW, box.h / inkH);
406
+ if (!Number.isFinite(fit) || fit <= 0) return;
407
+ const inkCx = (ink.left - frame.left) / per + inkW / 2;
408
+ const inkCy = (ink.top - frame.top) / per + inkH / 2;
409
+ const scale = box.h / LOGO_GRID;
410
+ const x = box.x + box.w / 2 + fit * (box.x - inkCx);
411
+ const y = box.y + box.h / 2 + fit * (box.y - inkCy);
412
+ g.setAttribute("transform", `translate(${x} ${y}) scale(${fit * scale})`);
413
+ }, [geometry.logoBox, geometry.logoTransform, geometry.extent, mark?.node]);
414
+ React.useEffect(() => {
415
+ if (logoAspect !== null) warnAspectOverflow("QrCode", "logo.aspect", logoAspect, logoRef.current);
416
+ }, [logoAspect, geometry.logoTransform]);
417
+ async function handleDownload(format) {
418
+ const svg = svgRef.current;
419
+ if (svg === null) return;
420
+ const edge = Math.max(1, Math.floor(pixelSize / geometry.extent)) * geometry.extent;
421
+ if (format === "svg") {
422
+ saveBlob(new Blob([serializeSvg(svg, edge)], { type: "image/svg+xml" }), `${fileName}.svg`);
423
+ return;
424
+ }
425
+ setRasterizing(true);
426
+ try {
427
+ saveBlob(await svgToPngBlob(svg, edge), `${fileName}.png`);
428
+ } finally {
429
+ setRasterizing(false);
430
+ }
431
+ }
432
+ return (
433
+ /* NO gap, deliberately — the plate brings its own. Its FOUR-MODULE quiet zone is real padding
434
+ (18px at `max-w-56`, 9px at `w-32`, scaling with the render width), and any flex gap stacks on top
435
+ of it: `gap-3` measured 30px from the last dark module to the button. The quiet zone IS the
436
+ separation, so the layout adds none. */
437
+ /* @__PURE__ */ jsxs("div", { className: cn("flex w-full flex-col items-center", className), children: [
438
+ /* @__PURE__ */ jsxs(
439
+ "svg",
440
+ {
441
+ ref: svgRef,
442
+ role: "img",
443
+ "aria-label": ariaLabel,
444
+ "aria-labelledby": ariaLabel === void 0 ? nameId : void 0,
445
+ viewBox: `0 0 ${geometry.extent} ${geometry.extent}`,
446
+ shapeRendering: shapeRenderingFor(modules, eyes),
447
+ className: "aspect-square w-full max-w-full",
448
+ children: [
449
+ /* @__PURE__ */ jsx("rect", { width: geometry.extent, height: geometry.extent, fill: "#ffffff" }),
450
+ " ",
451
+ geometry.path !== "" && /* @__PURE__ */ jsx("path", { d: geometry.path, fill: dark }),
452
+ geometry.eyePath !== "" && /* @__PURE__ */ jsx("path", { d: geometry.eyePath, fill: ring, fillRule: "evenodd" }),
453
+ geometry.pupilPath !== "" && /* @__PURE__ */ jsx("path", { d: geometry.pupilPath, fill: pupil }),
454
+ geometry.hole !== null && /* @__PURE__ */ jsx(
455
+ "rect",
456
+ {
457
+ x: geometry.hole.x,
458
+ y: geometry.hole.y,
459
+ width: geometry.hole.w,
460
+ height: geometry.hole.h,
461
+ rx: geometry.hole.r === 0 ? void 0 : geometry.hole.r,
462
+ shapeRendering: geometry.hole.r === 0 ? void 0 : "geometricPrecision",
463
+ fill: "#ffffff"
464
+ }
465
+ ),
466
+ geometry.logoTransform !== null && /* A `<g transform>`, NOT a nested `<svg width height>`: a lucide glyph carries its own
467
+ * `width="24" height="24"`, which inside a nested viewport would render at 24 MODULES and
468
+ * clip. A transform scales whatever arrives. And `style` rather than a class, because
469
+ * `currentColor` must resolve to the code's own dark once the file is opened standalone and a
470
+ * stylesheet does not travel with it — `serializeSvg` strips classes for exactly that reason.
471
+ * It takes `dark` rather than black so a green code gets a green mark.
472
+ *
473
+ * No `aria-hidden`: hiding the caller's node is a one-way door (AGENTS §Slots). A decorative
474
+ * mark hides itself. */
475
+ /* @__PURE__ */ jsx("g", { ref: logoRef, transform: geometry.logoTransform, style: { color: dark }, children: mark?.node })
476
+ ]
477
+ }
478
+ ),
479
+ ariaLabel === void 0 && /* @__PURE__ */ jsx("span", { id: nameId, className: "sr-only", children: geometry.unencodable ? t.unavailable : t.name({ value }) }),
480
+ options !== null && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap justify-center gap-2", children: formats.map((format) => /* @__PURE__ */ jsx(
481
+ Button,
482
+ {
483
+ variant: "secondary",
484
+ size: "sm",
485
+ leading: /* @__PURE__ */ jsx(DownloadIcon, {}),
486
+ loading: format === "png" && rasterizing,
487
+ disabled: geometry.unencodable,
488
+ onClick: () => void handleDownload(format),
489
+ children: t[DOWNLOAD_LABEL[format]]
490
+ },
491
+ format
492
+ )) })
493
+ ] })
494
+ );
495
+ }
496
+
497
+ // src/components/qr-code/to-file.ts
498
+ var DEFAULT_PIXEL_SIZE2 = 1024;
499
+ function snap(pixelSize, extent) {
500
+ return Math.max(1, Math.floor(pixelSize / extent)) * extent;
501
+ }
502
+ function qrToSvgString(value, options) {
503
+ const ecc = options?.ecc ?? "H";
504
+ const color = resolveQrColor(options?.color);
505
+ const ring = options?.eyeColor === void 0 ? color : resolveQrColor(options.eyeColor, "eyeColor");
506
+ const pupil = options?.pupilColor === void 0 ? ring : resolveQrColor(options.pupilColor, "pupilColor");
507
+ const { extent, path, eyePath, pupilPath, unencodable } = buildQrGeometry(value, {
508
+ ecc,
509
+ modules: options?.modules,
510
+ eyes: options?.eyes,
511
+ tintedEyes: ring !== color || pupil !== ring
512
+ });
513
+ if (unencodable) throw new RangeError(`qrToSvgString: "${value.slice(0, 32)}" does not encode at level ${ecc}.`);
514
+ const size = snap(options?.pixelSize ?? DEFAULT_PIXEL_SIZE2, extent);
515
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${extent} ${extent}" shape-rendering="${shapeRenderingFor(options?.modules, options?.eyes)}"><rect width="${extent}" height="${extent}" fill="#ffffff"/>` + (path === "" ? "" : `<path d="${path}" fill="${color}"/>`) + (eyePath === "" ? "" : `<path d="${eyePath}" fill="${ring}" fill-rule="evenodd"/>`) + (pupilPath === "" ? "" : `<path d="${pupilPath}" fill="${pupil}"/>`) + `</svg>`;
516
+ }
517
+ async function qrToPngBlob(value, options) {
518
+ const { extent } = buildQrGeometry(value, { ecc: options?.ecc ?? "H", modules: options?.modules, eyes: options?.eyes });
519
+ const size = snap(options?.pixelSize ?? DEFAULT_PIXEL_SIZE2, extent);
520
+ return await rasterizeSvgMarkup(qrToSvgString(value, { ...options, pixelSize: size }), size);
521
+ }
522
+
523
+ export { QrCode, qrToPngBlob, qrToSvgString };
524
+ //# sourceMappingURL=chunk-UJ4WEQHR.js.map
525
+ //# sourceMappingURL=chunk-UJ4WEQHR.js.map
@@ -1,7 +1,7 @@
1
1
  import { useScrollFade } from './chunk-O2LG3PNI.js';
2
2
  import { useIsomorphicLayoutEffect } from './chunk-EDSK6FEH.js';
3
3
  import { cn } from './chunk-ZSNJ6UA3.js';
4
- import { warnPositiveInt } from './chunk-QDYE5LVT.js';
4
+ import { warnPositiveInt } from './chunk-SF3HCW4G.js';
5
5
  import * as React from 'react';
6
6
 
7
7
  function tagShellPy(size, hasPills) {
@@ -76,5 +76,5 @@ function useTagRow(opts) {
76
76
  }
77
77
 
78
78
  export { useTagRow };
79
- //# sourceMappingURL=chunk-IEAWNA3V.js.map
80
- //# sourceMappingURL=chunk-IEAWNA3V.js.map
79
+ //# sourceMappingURL=chunk-VDFWWWLL.js.map
80
+ //# sourceMappingURL=chunk-VDFWWWLL.js.map
@@ -1,7 +1,7 @@
1
- import { TooltipExport } from './chunk-KZP6B6B3.js';
2
- import { CircleHelpIcon } from './chunk-BLIZ3CL3.js';
1
+ import { TooltipExport } from './chunk-KTWTYK5U.js';
2
+ import { CircleHelpIcon } from './chunk-YGFTNICV.js';
3
3
  import { cn } from './chunk-ZSNJ6UA3.js';
4
- import { useLabels } from './chunk-RJTVCA62.js';
4
+ import { useLabels } from './chunk-ZJIY642R.js';
5
5
  import { Field } from '@base-ui/react/field';
6
6
  import 'react';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -156,5 +156,5 @@ function FieldGroupFrame(props) {
156
156
  }
157
157
 
158
158
  export { BAR_SIZE, CONTROL_ICON, CONTROL_RADIUS, CONTROL_TEXT, FIELD_LABEL_CLASS, FieldFrame, FieldGroupFrame, LISTBOX_PX_SM, SHELL_SIZE, SLOT_ICON, useFieldValidity };
159
- //# sourceMappingURL=chunk-5KSD4WKN.js.map
160
- //# sourceMappingURL=chunk-5KSD4WKN.js.map
159
+ //# sourceMappingURL=chunk-VIKV25VP.js.map
160
+ //# sourceMappingURL=chunk-VIKV25VP.js.map
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+
3
+ // src/lib/use-controllable.ts
4
+ function useControllable(controlled, uncontrolledInitial, onChange) {
5
+ const [uncontrolled, setUncontrolled] = React.useState(uncontrolledInitial);
6
+ const isControlled = controlled !== void 0;
7
+ const value = isControlled ? controlled : uncontrolled;
8
+ const set = React.useCallback(
9
+ (next) => {
10
+ if (!isControlled) setUncontrolled(next);
11
+ onChange?.(next);
12
+ },
13
+ [isControlled, onChange]
14
+ );
15
+ return [value, set];
16
+ }
17
+
18
+ export { useControllable };
19
+ //# sourceMappingURL=chunk-WJB5GWAZ.js.map
20
+ //# sourceMappingURL=chunk-WJB5GWAZ.js.map
@@ -1,14 +1,14 @@
1
- import { Progress } from './chunk-33TOK7ES.js';
2
- import { Separator } from './chunk-7VLYQR4D.js';
1
+ import { Progress } from './chunk-DCKVNHV5.js';
3
2
  import { FileTrigger } from './chunk-DJSXIAFH.js';
4
- import { Button } from './chunk-OACWA4TC.js';
5
- import { ButtonUtility } from './chunk-AZ7DKRBY.js';
6
- import { SOLID } from './chunk-MCQG4H6T.js';
7
- import { useFieldValidity, FieldFrame } from './chunk-5KSD4WKN.js';
8
- import { UploadCloudIcon, FileIcon, CircleXIcon, CircleCheckIcon, Trash2Icon, XIcon } from './chunk-BLIZ3CL3.js';
3
+ import { Separator } from './chunk-7OFGPDYJ.js';
4
+ import { Button } from './chunk-R25NHHYT.js';
5
+ import { ButtonUtility } from './chunk-MVF7FA4D.js';
6
+ import { SOLID } from './chunk-6T3QAO5K.js';
7
+ import { useFieldValidity, FieldFrame } from './chunk-VIKV25VP.js';
8
+ import { UploadCloudIcon, FileIcon, CircleXIcon, CircleCheckIcon, Trash2Icon, XIcon } from './chunk-YGFTNICV.js';
9
9
  import { cn } from './chunk-ZSNJ6UA3.js';
10
- import { useLabels } from './chunk-RJTVCA62.js';
11
- import { warnNonNegativeInt, devWarn, warnRange } from './chunk-QDYE5LVT.js';
10
+ import { useLabels } from './chunk-ZJIY642R.js';
11
+ import { warnNonNegativeInt, devWarn, warnRange } from './chunk-SF3HCW4G.js';
12
12
  import { mergeProps } from '@base-ui/react/merge-props';
13
13
  import { useRender } from '@base-ui/react/use-render';
14
14
  import * as React from 'react';
@@ -521,5 +521,5 @@ function FileList(props) {
521
521
  }
522
522
 
523
523
  export { Dropzone, FILE_TONE, FILE_TONE_BUCKETS, FileList, FileTypeGlyph, GLYPH_BOX, bucketFiles, extensionTone, fileExtension, fileGlyphSource, fileTone, formatFileSize, invalidAcceptEntries, isFileTypeAccepted, toUploadFile };
524
- //# sourceMappingURL=chunk-HHYEAFCL.js.map
525
- //# sourceMappingURL=chunk-HHYEAFCL.js.map
524
+ //# sourceMappingURL=chunk-XAQQ4LYL.js.map
525
+ //# sourceMappingURL=chunk-XAQQ4LYL.js.map
@@ -1,14 +1,14 @@
1
1
  import { DRAG_GHOST, DROP_LINE, DROP_LINE_Y, DROP_LINE_X, dragGhostProps, ghostPosition } from './chunk-5ZPUAGOP.js';
2
- import { useAutoScroll, useDrag } from './chunk-P6CON2R2.js';
3
- import { DropdownMenu } from './chunk-ZD3MOLIB.js';
4
- import { Skeleton } from './chunk-LLPWQDF7.js';
2
+ import { Skeleton } from './chunk-MTOTPAYZ.js';
3
+ import { useAutoScroll, useDrag } from './chunk-BH32X25C.js';
4
+ import { DropdownMenu } from './chunk-5GBA6X6A.js';
5
5
  import { surfaceBox } from './chunk-45Y2ZGNK.js';
6
- import { ButtonUtility } from './chunk-AZ7DKRBY.js';
6
+ import { ButtonUtility } from './chunk-MVF7FA4D.js';
7
7
  import { Slot } from './chunk-52IFGFTL.js';
8
- import { ChevronsRightIcon, ChevronRightIcon, ChevronDownIcon, GripVerticalIcon, ChevronsLeftIcon, EllipsisIcon, PlusIcon, LoaderCircleIcon, RotateCwIcon } from './chunk-BLIZ3CL3.js';
8
+ import { ChevronsRightIcon, ChevronRightIcon, ChevronDownIcon, GripVerticalIcon, ChevronsLeftIcon, EllipsisIcon, PlusIcon, LoaderCircleIcon, RotateCwIcon } from './chunk-YGFTNICV.js';
9
9
  import { cn } from './chunk-ZSNJ6UA3.js';
10
- import { useLabels, usePublishedLabels, LabelsContext } from './chunk-RJTVCA62.js';
11
- import { warnNeedsName, devWarn } from './chunk-QDYE5LVT.js';
10
+ import { useLabels, usePublishedLabels, LabelsContext } from './chunk-ZJIY642R.js';
11
+ import { warnNeedsName, devWarn } from './chunk-SF3HCW4G.js';
12
12
  import * as React from 'react';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
14
 
@@ -1506,5 +1506,5 @@ function useKanban(options) {
1506
1506
  }
1507
1507
 
1508
1508
  export { KanbanBoard, cellKey, useKanban };
1509
- //# sourceMappingURL=chunk-KJ5JUS53.js.map
1510
- //# sourceMappingURL=chunk-KJ5JUS53.js.map
1509
+ //# sourceMappingURL=chunk-XCFFM2C7.js.map
1510
+ //# sourceMappingURL=chunk-XCFFM2C7.js.map