@krizaka/ui 3.78.1 → 3.79.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 (232) hide show
  1. package/README.md +1 -0
  2. package/dist/chunk-BCD2CRFG.js +349 -0
  3. package/dist/chunk-BCD2CRFG.js.map +1 -0
  4. package/dist/{chunk-SG3QJJXE.js → chunk-ENFXJUDN.js} +3 -16
  5. package/dist/chunk-ENFXJUDN.js.map +1 -0
  6. package/dist/filter-bar.d.ts +3 -3
  7. package/dist/identity-card.d.ts +39 -0
  8. package/dist/identity-card.js +34 -0
  9. package/dist/identity-card.js.map +1 -0
  10. package/dist/nav-bar.d.ts +1 -1
  11. package/dist/nav-bar.js +63 -53
  12. package/dist/nav-bar.js.map +1 -1
  13. package/dist/qr-code.d.ts +25 -2
  14. package/dist/qr-code.js +29 -339
  15. package/dist/qr-code.js.map +1 -1
  16. package/dist/{schema-CL7t7xqb.d.ts → schema-DgjBz7-8.d.ts} +1 -1
  17. package/dist/shop.d.ts +2 -2
  18. package/dist/site-cahier.d.ts +32 -19
  19. package/dist/site-cahier.js +106 -95
  20. package/dist/site-cahier.js.map +1 -1
  21. package/dist/site-footer.d.ts +59 -39
  22. package/dist/site-footer.js +93 -67
  23. package/dist/site-footer.js.map +1 -1
  24. package/dist/{sites-CVNSirrg.d.ts → sites-BLqbwmng.d.ts} +14 -0
  25. package/dist/sites.d.ts +28 -2
  26. package/dist/sites.js +10 -0
  27. package/dist/sites.js.map +1 -1
  28. package/package.json +17 -3
  29. package/registry/account-menu.json +1 -1
  30. package/registry/account-settings.json +1 -1
  31. package/registry/achievement.json +1 -1
  32. package/registry/action-bar.json +1 -1
  33. package/registry/activity-feed.json +1 -1
  34. package/registry/agenda.json +1 -1
  35. package/registry/alert.json +1 -1
  36. package/registry/analysis-report.json +1 -1
  37. package/registry/anatomy-plate.json +1 -1
  38. package/registry/app-frame.json +2 -2
  39. package/registry/app-header.json +1 -1
  40. package/registry/app-shell.json +1 -1
  41. package/registry/argument-card.json +1 -1
  42. package/registry/auth-layout.json +1 -1
  43. package/registry/avatar.json +1 -1
  44. package/registry/badge.json +1 -1
  45. package/registry/bird-plate.json +1 -1
  46. package/registry/button.json +1 -1
  47. package/registry/captcha.json +1 -1
  48. package/registry/card-grid.json +1 -1
  49. package/registry/card.json +1 -1
  50. package/registry/catalogue-page.json +1 -1
  51. package/registry/changelog-page.json +1 -1
  52. package/registry/chapter.json +1 -1
  53. package/registry/chat.json +1 -1
  54. package/registry/checkbox.json +1 -1
  55. package/registry/chip-link.json +1 -1
  56. package/registry/chip-row.json +1 -1
  57. package/registry/chip.json +1 -1
  58. package/registry/choice-grid.json +1 -1
  59. package/registry/code-block.json +1 -1
  60. package/registry/collection-switcher.json +1 -1
  61. package/registry/combobox.json +1 -1
  62. package/registry/command.json +1 -1
  63. package/registry/comparison-table.json +1 -1
  64. package/registry/component-page.json +1 -1
  65. package/registry/confirm-button.json +1 -1
  66. package/registry/contact-page.json +1 -1
  67. package/registry/continue-prompt.json +1 -1
  68. package/registry/copy-button.json +1 -1
  69. package/registry/countdown.json +1 -1
  70. package/registry/cover-hero.json +1 -1
  71. package/registry/cta-panel.json +1 -1
  72. package/registry/dashboard-layout.json +1 -1
  73. package/registry/data-table.json +1 -1
  74. package/registry/date-picker.json +1 -1
  75. package/registry/decision-list.json +1 -1
  76. package/registry/description-list.json +1 -1
  77. package/registry/desktop-window.json +1 -1
  78. package/registry/detail-layout.json +1 -1
  79. package/registry/dialog.json +1 -1
  80. package/registry/docs-article-page.json +1 -1
  81. package/registry/docs-hub-page.json +1 -1
  82. package/registry/docs-layout.json +1 -1
  83. package/registry/docs-nav.json +1 -1
  84. package/registry/document-viewer.json +1 -1
  85. package/registry/doodle.json +1 -1
  86. package/registry/drop-overlay.json +1 -1
  87. package/registry/dropdown-menu.json +1 -1
  88. package/registry/elephant.json +1 -1
  89. package/registry/embed-facade.json +1 -1
  90. package/registry/empty-state.json +1 -1
  91. package/registry/engine-flow.json +1 -1
  92. package/registry/entity-header.json +1 -1
  93. package/registry/environment-notice.json +1 -1
  94. package/registry/error-page.json +1 -1
  95. package/registry/examples/identity-card/basic.d.ts +4 -0
  96. package/registry/examples/identity-card/basic.js +33 -0
  97. package/registry/examples/identity-card/basic.tsx +29 -0
  98. package/registry/examples/site-footer/company.js +1 -0
  99. package/registry/examples/site-footer/company.tsx +3 -2
  100. package/registry/examples/site-footer/docs.tsx +1 -1
  101. package/registry/examples/site-footer/open-source-fr.js +1 -1
  102. package/registry/examples/site-footer/open-source-fr.tsx +1 -1
  103. package/registry/examples/site-footer/product.js +9 -14
  104. package/registry/examples/site-footer/product.tsx +14 -12
  105. package/registry/field.json +1 -1
  106. package/registry/file-upload.json +1 -1
  107. package/registry/filter-bar.json +1 -1
  108. package/registry/flock.json +1 -1
  109. package/registry/footnote.json +1 -1
  110. package/registry/force-update-screen.json +1 -1
  111. package/registry/form.json +1 -1
  112. package/registry/gallery-page.json +1 -1
  113. package/registry/genui.json +1 -1
  114. package/registry/glossary-term.json +1 -1
  115. package/registry/glossary.json +1 -1
  116. package/registry/glow-card.json +1 -1
  117. package/registry/goal-gauge.json +1 -1
  118. package/registry/grade-stamp.json +1 -1
  119. package/registry/identity-card.json +218 -0
  120. package/registry/image-cropper.json +1 -1
  121. package/registry/index.json +40 -9
  122. package/registry/kanban.json +1 -1
  123. package/registry/kbd.json +1 -1
  124. package/registry/kind-config-editor.json +1 -1
  125. package/registry/kpi-explained.json +1 -1
  126. package/registry/landing-page.json +1 -1
  127. package/registry/landscape.json +1 -1
  128. package/registry/language-switch.json +1 -1
  129. package/registry/legal-page.json +1 -1
  130. package/registry/link-card.json +1 -1
  131. package/registry/list.json +1 -1
  132. package/registry/loader.json +1 -1
  133. package/registry/longform-page.json +1 -1
  134. package/registry/maintenance-screen.json +1 -1
  135. package/registry/map.json +2 -2
  136. package/registry/margin-layout.json +1 -1
  137. package/registry/markdown.json +1 -1
  138. package/registry/marketing-layout.json +1 -1
  139. package/registry/mascot-quote.json +1 -1
  140. package/registry/mascot-state.json +1 -1
  141. package/registry/mascots.json +1 -1
  142. package/registry/match-dialog.json +1 -1
  143. package/registry/media-capture.json +1 -1
  144. package/registry/media-gallery.json +1 -1
  145. package/registry/meter.json +1 -1
  146. package/registry/money-input.json +1 -1
  147. package/registry/nav-bar.json +2 -2
  148. package/registry/next-actions.json +1 -1
  149. package/registry/notification-preferences.json +1 -1
  150. package/registry/number-ticker.json +1 -1
  151. package/registry/opening-hours.json +1 -1
  152. package/registry/page-header.json +1 -1
  153. package/registry/page-hero.json +1 -1
  154. package/registry/page-index.json +1 -1
  155. package/registry/page.json +1 -1
  156. package/registry/pagination.json +1 -1
  157. package/registry/pointer-light.json +1 -1
  158. package/registry/popover.json +1 -1
  159. package/registry/price-catalogue-editor.json +1 -1
  160. package/registry/pricing-page.json +1 -1
  161. package/registry/product-page.json +1 -1
  162. package/registry/profile-card.json +1 -1
  163. package/registry/progress.json +1 -1
  164. package/registry/promise-card.json +1 -1
  165. package/registry/promo-code-field.json +1 -1
  166. package/registry/proposal.json +1 -1
  167. package/registry/qr-code.json +6 -2
  168. package/registry/quota-meter.json +1 -1
  169. package/registry/radio-group.json +1 -1
  170. package/registry/rail-nav.json +2 -2
  171. package/registry/recipes.json +1 -1
  172. package/registry/retro-tv.json +1 -1
  173. package/registry/reviews.json +1 -1
  174. package/registry/router.json +1 -1
  175. package/registry/schema-form.json +1 -1
  176. package/registry/scroll-stage.json +1 -1
  177. package/registry/search-field.json +1 -1
  178. package/registry/section-backdrop.json +1 -1
  179. package/registry/separator.json +1 -1
  180. package/registry/service-card.json +1 -1
  181. package/registry/settings-layout.json +1 -1
  182. package/registry/shop-composer.json +1 -1
  183. package/registry/shop-gallery.json +1 -1
  184. package/registry/shop.json +2 -2
  185. package/registry/showcase.json +1 -1
  186. package/registry/signature.json +1 -1
  187. package/registry/site-cahier.json +1 -1
  188. package/registry/site-footer.json +81 -58
  189. package/registry/sites.json +7 -3
  190. package/registry/skeleton.json +1 -1
  191. package/registry/skip-link.json +1 -1
  192. package/registry/slider.json +1 -1
  193. package/registry/slot-picker.json +1 -1
  194. package/registry/slot.json +1 -1
  195. package/registry/specimen-tag.json +1 -1
  196. package/registry/speed-lines.json +1 -1
  197. package/registry/spinner.json +1 -1
  198. package/registry/split-view.json +1 -1
  199. package/registry/stage-banner.json +1 -1
  200. package/registry/stat.json +1 -1
  201. package/registry/status-chip.json +1 -1
  202. package/registry/status-page.json +1 -1
  203. package/registry/step-progress.json +1 -1
  204. package/registry/step-showcase.json +1 -1
  205. package/registry/stepper.json +1 -1
  206. package/registry/sticky-action.json +1 -1
  207. package/registry/stuck.json +1 -1
  208. package/registry/swipe-deck.json +1 -1
  209. package/registry/switch.json +1 -1
  210. package/registry/tabs.json +1 -1
  211. package/registry/tag-input.json +1 -1
  212. package/registry/tag-selector.json +1 -1
  213. package/registry/taped-photo.json +1 -1
  214. package/registry/terminal-replay.json +1 -1
  215. package/registry/text-style.json +1 -1
  216. package/registry/theme.json +1 -1
  217. package/registry/toast.json +1 -1
  218. package/registry/toc.json +1 -1
  219. package/registry/tooltip.json +1 -1
  220. package/registry/tree-view.json +1 -1
  221. package/registry/update-prompt.json +1 -1
  222. package/registry/upload-queue.json +1 -1
  223. package/registry/usage.json +1 -1
  224. package/registry/verified-badge.json +1 -1
  225. package/registry/versus-card.json +1 -1
  226. package/registry/vertical-video.json +1 -1
  227. package/registry/video-player.json +1 -1
  228. package/registry/video-trimmer.json +1 -1
  229. package/registry/virtual.json +1 -1
  230. package/registry/wall.json +1 -1
  231. package/registry/waveform.json +1 -1
  232. package/dist/chunk-SG3QJJXE.js.map +0 -1
package/README.md CHANGED
@@ -195,6 +195,7 @@ light or a product's — is a set of tokens.
195
195
  | `@krizaka/ui/video-trimmer` | `VideoTrimmer` (`duration`, `value` [start, end], `minLength`, `step`/`largeStep`, `frames` or children, `time` + `onSeek`, `classNames` per part, `renderHandle`) | client |
196
196
  | `@krizaka/ui/waveform` | `Waveform` (`peaks`, `bars`, `size` sm·md·lg, `tone` accent·neutral, `playing`, `label`): the bars of a sound, decorative by default (`aria-hidden`), breathing gently while it plays, still under reduced motion and off screen; `/native` has the same | client |
197
197
  | `@krizaka/ui/qr-code` | `QrCode` (`value`, `label`, `size`, `quietZone`, `level` L·M·Q·H, `copyLabel` / `copiedLabel` / `onCopy`) and the pure `encodeQr` / `qrPath`: a QR code drawn offline, dark modules on a light tile in both themes, an image named by `label`; `/native` has the same (`onCopy` receives the text) | client |
198
+ | `@krizaka/ui/identity-card` | `IdentityCard` (`mark`, `name`, `subtitle`, `chips`, `qr`): the identity of a business or a person at the top of a sheet, with a contact QR code (`vCard(fields)` of `qr-code` writes the text) | client |
198
199
  | `@krizaka/ui/entity-header` | `EntityHeader` (`name` / `onNameChange`, `description` / `onDescriptionChange`, `avatar`, `avatarPicker`, `tags`, `refusal` + `refusals` by `OrganizeCode`, `actions`): the head of a collection, shop or studio, edited in place; `/native` has the same (`onAvatarPress`) | client |
199
200
  | `@krizaka/ui/collection-switcher` | `CollectionSwitcher` (`collections` with `parentId` / `isDefault` / `count`, `value` from the URL, `onValueChange` or `href`, `layout` list·tree, `mode` collection·entity, `onRemove` never on the default one, `onCreate`), `collectionTree`; `/native` has the same | client |
200
201
  | `@krizaka/ui/image-cropper` | `ImageCropper` (`aspect`, `round`, an image or a `<video>`, a focus point + zoom out, keyboard and zoom slider), `cropRect` | client |
@@ -0,0 +1,349 @@
1
+ import {
2
+ CheckGlyph,
3
+ CopyGlyph
4
+ } from "./chunk-C57KK5VB.js";
5
+ import {
6
+ Button
7
+ } from "./chunk-EB45EVPJ.js";
8
+ import {
9
+ cn
10
+ } from "./chunk-W675RFOA.js";
11
+
12
+ // src/qr-code/encode.ts
13
+ var LEVEL_INDEX = { L: 0, M: 1, Q: 2, H: 3 };
14
+ var LEVEL_BITS = { L: 1, M: 0, Q: 3, H: 2 };
15
+ var ECC_PER_BLOCK = [
16
+ [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
17
+ [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
18
+ [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
19
+ [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
20
+ ];
21
+ var BLOCKS = [
22
+ [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
23
+ [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
24
+ [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
25
+ [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
26
+ ];
27
+ function rawModules(version) {
28
+ let result = (16 * version + 128) * version + 64;
29
+ if (version >= 2) {
30
+ const align = Math.floor(version / 7) + 2;
31
+ result -= (25 * align - 10) * align - 55;
32
+ if (version >= 7) result -= 36;
33
+ }
34
+ return result;
35
+ }
36
+ function dataCodewords(version, level) {
37
+ const l = LEVEL_INDEX[level];
38
+ return Math.floor(rawModules(version) / 8) - ECC_PER_BLOCK[l][version] * BLOCKS[l][version];
39
+ }
40
+ function utf8(text) {
41
+ return [...new TextEncoder().encode(text)];
42
+ }
43
+ function gfMultiply(x, y) {
44
+ let z = 0;
45
+ for (let i = 7; i >= 0; i--) {
46
+ z = z << 1 ^ (z >>> 7) * 285;
47
+ z ^= (y >>> i & 1) * x;
48
+ }
49
+ return z;
50
+ }
51
+ function divisor(degree) {
52
+ const result = new Array(degree).fill(0);
53
+ result[degree - 1] = 1;
54
+ let root = 1;
55
+ for (let i = 0; i < degree; i++) {
56
+ for (let j = 0; j < degree; j++) {
57
+ result[j] = gfMultiply(result[j], root);
58
+ if (j + 1 < degree) result[j] = result[j] ^ result[j + 1];
59
+ }
60
+ root = gfMultiply(root, 2);
61
+ }
62
+ return result;
63
+ }
64
+ function remainder(data, div) {
65
+ const result = div.map(() => 0);
66
+ for (const b of data) {
67
+ const factor = b ^ result.shift();
68
+ result.push(0);
69
+ div.forEach((coef, i) => {
70
+ result[i] = result[i] ^ gfMultiply(coef, factor);
71
+ });
72
+ }
73
+ return result;
74
+ }
75
+ function pushBits(bits, value, count) {
76
+ for (let i = count - 1; i >= 0; i--) bits.push(value >>> i & 1);
77
+ }
78
+ function codewords(bytes, version, level) {
79
+ const bits = [];
80
+ pushBits(bits, 4, 4);
81
+ pushBits(bits, bytes.length, version <= 9 ? 8 : 16);
82
+ for (const b of bytes) pushBits(bits, b, 8);
83
+ const capacity = dataCodewords(version, level) * 8;
84
+ pushBits(bits, 0, Math.min(4, capacity - bits.length));
85
+ pushBits(bits, 0, (8 - bits.length % 8) % 8);
86
+ let pad = 236;
87
+ while (bits.length < capacity) {
88
+ pushBits(bits, pad, 8);
89
+ pad ^= 236 ^ 17;
90
+ }
91
+ const data = [];
92
+ for (let i = 0; i < bits.length; i += 8) data.push(parseInt(bits.slice(i, i + 8).join(""), 2));
93
+ const l = LEVEL_INDEX[level];
94
+ const blocks = BLOCKS[l][version];
95
+ const eccLen = ECC_PER_BLOCK[l][version];
96
+ const shortBlocks = blocks - Math.floor(rawModules(version) / 8) % blocks;
97
+ const shortLen = Math.floor(rawModules(version) / 8 / blocks) - eccLen;
98
+ const div = divisor(eccLen);
99
+ const parts = [];
100
+ for (let i = 0, k = 0; i < blocks; i++) {
101
+ const chunk = data.slice(k, k + shortLen + (i < shortBlocks ? 0 : 1));
102
+ k += chunk.length;
103
+ parts.push({ data: chunk, ecc: remainder(chunk, div) });
104
+ }
105
+ const out = [];
106
+ for (let i = 0; i <= shortLen; i++) parts.forEach((p) => i < p.data.length && out.push(p.data[i]));
107
+ for (let i = 0; i < eccLen; i++) parts.forEach((p) => out.push(p.ecc[i]));
108
+ return out;
109
+ }
110
+ function alignmentPositions(version) {
111
+ if (version === 1) return [];
112
+ const count = Math.floor(version / 7) + 2;
113
+ const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;
114
+ const result = [6];
115
+ let pos = version * 4 + 10;
116
+ while (result.length < count) {
117
+ result.splice(1, 0, pos);
118
+ pos -= step;
119
+ }
120
+ return result;
121
+ }
122
+ function drawFunctionPatterns(version, level) {
123
+ const size = version * 4 + 17;
124
+ const dark = Array.from({ length: size }, () => new Array(size).fill(false));
125
+ const fn = Array.from({ length: size }, () => new Array(size).fill(false));
126
+ const set = (x, y, on) => {
127
+ dark[y][x] = on;
128
+ fn[y][x] = true;
129
+ };
130
+ for (let i = 0; i < size; i++) {
131
+ set(6, i, i % 2 === 0);
132
+ set(i, 6, i % 2 === 0);
133
+ }
134
+ const finder = (cx, cy) => {
135
+ for (let dy = -4; dy <= 4; dy++)
136
+ for (let dx = -4; dx <= 4; dx++) {
137
+ const x = cx + dx;
138
+ const y = cy + dy;
139
+ if (x < 0 || x >= size || y < 0 || y >= size) continue;
140
+ const dist = Math.max(Math.abs(dx), Math.abs(dy));
141
+ set(x, y, dist !== 2 && dist !== 4);
142
+ }
143
+ };
144
+ finder(3, 3);
145
+ finder(size - 4, 3);
146
+ finder(3, size - 4);
147
+ const align = alignmentPositions(version);
148
+ align.forEach(
149
+ (cx, i) => align.forEach((cy, j) => {
150
+ if (i === 0 && j === 0 || i === 0 && j === align.length - 1 || i === align.length - 1 && j === 0) return;
151
+ for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) set(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
152
+ })
153
+ );
154
+ drawFormat(dark, fn, size, level, 0);
155
+ if (version >= 7) {
156
+ let rem = version;
157
+ for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
158
+ const bits = version << 12 | rem;
159
+ for (let i = 0; i < 18; i++) {
160
+ const on = (bits >>> i & 1) !== 0;
161
+ const a = size - 11 + i % 3;
162
+ const b = Math.floor(i / 3);
163
+ set(a, b, on);
164
+ set(b, a, on);
165
+ }
166
+ }
167
+ return { size, dark, fn };
168
+ }
169
+ function drawFormat(dark, fn, size, level, mask) {
170
+ const data = LEVEL_BITS[level] << 3 | mask;
171
+ let rem = data;
172
+ for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
173
+ const bits = (data << 10 | rem) ^ 21522;
174
+ const bit = (i) => (bits >>> i & 1) !== 0;
175
+ const set = (x, y, on) => {
176
+ dark[y][x] = on;
177
+ fn[y][x] = true;
178
+ };
179
+ for (let i = 0; i <= 5; i++) set(8, i, bit(i));
180
+ set(8, 7, bit(6));
181
+ set(8, 8, bit(7));
182
+ set(7, 8, bit(8));
183
+ for (let i = 9; i < 15; i++) set(14 - i, 8, bit(i));
184
+ for (let i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));
185
+ for (let i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));
186
+ set(8, size - 8, true);
187
+ }
188
+ function* dataPositions(size) {
189
+ for (let right = size - 1; right >= 1; right -= 2) {
190
+ if (right === 6) right = 5;
191
+ for (let vert = 0; vert < size; vert++) {
192
+ const y = (right + 1 & 2) === 0 ? size - 1 - vert : vert;
193
+ yield [right, y];
194
+ yield [right - 1, y];
195
+ }
196
+ }
197
+ }
198
+ function placeData(grid, data) {
199
+ const { size, dark, fn } = grid;
200
+ let i = 0;
201
+ for (const [x, y] of dataPositions(size)) {
202
+ if (fn[y][x] || i >= data.length * 8) continue;
203
+ dark[y][x] = (data[i >>> 3] >>> 7 - (i & 7) & 1) !== 0;
204
+ i++;
205
+ }
206
+ }
207
+ var MASKS = [
208
+ (x, y) => (x + y) % 2 === 0,
209
+ (_x, y) => y % 2 === 0,
210
+ (x) => x % 3 === 0,
211
+ (x, y) => (x + y) % 3 === 0,
212
+ (x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,
213
+ (x, y) => x * y % 2 + x * y % 3 === 0,
214
+ (x, y) => (x * y % 2 + x * y % 3) % 2 === 0,
215
+ (x, y) => ((x + y) % 2 + x * y % 3) % 2 === 0
216
+ ];
217
+ function runPenalty(line) {
218
+ let score = 0;
219
+ let run = 1;
220
+ for (let i = 1; i < line.length; i++) {
221
+ run = line[i] === line[i - 1] ? run + 1 : 1;
222
+ if (run === 5) score += 3;
223
+ else if (run > 5) score++;
224
+ }
225
+ return score;
226
+ }
227
+ function finderPenalty(line) {
228
+ const text = line.map((on) => on ? "1" : "0").join("");
229
+ let score = 0;
230
+ for (const pattern of ["00001011101", "10111010000"]) {
231
+ for (let at = text.indexOf(pattern); at >= 0; at = text.indexOf(pattern, at + 1)) score += 40;
232
+ }
233
+ return score;
234
+ }
235
+ function blockPenalty(dark) {
236
+ let score = 0;
237
+ for (let y = 0; y < dark.length - 1; y++)
238
+ for (let x = 0; x < dark.length - 1; x++) {
239
+ const c = dark[y][x];
240
+ if (c === dark[y][x + 1] && c === dark[y + 1][x] && c === dark[y + 1][x + 1]) score += 3;
241
+ }
242
+ return score;
243
+ }
244
+ function balancePenalty(dark) {
245
+ const size = dark.length;
246
+ const total = dark.reduce((n, row) => n + row.filter(Boolean).length, 0);
247
+ return (Math.ceil(Math.abs(total * 20 - size * size * 10) / (size * size)) - 1) * 10;
248
+ }
249
+ function penalty(dark) {
250
+ const columns = dark.map((_, x) => dark.map((row) => row[x]));
251
+ const lines = [...dark, ...columns];
252
+ return lines.reduce((n, line) => n + runPenalty(line) + finderPenalty(line), 0) + blockPenalty(dark) + balancePenalty(dark);
253
+ }
254
+ var QrTooLongError = class extends Error {
255
+ constructor(length, level) {
256
+ super(`The text (${length} bytes) is too long for a QR code at level ${level}.`);
257
+ this.name = "QrTooLongError";
258
+ }
259
+ };
260
+ function smallestVersion(bytes, level) {
261
+ for (let version = 1; version <= 40; version++) {
262
+ if (4 + (version <= 9 ? 8 : 16) + bytes.length * 8 <= dataCodewords(version, level) * 8) return version;
263
+ }
264
+ throw new QrTooLongError(bytes.length, level);
265
+ }
266
+ function masked(base, mask, level) {
267
+ const dark = base.dark.map((row) => [...row]);
268
+ const fn = base.fn.map((row) => [...row]);
269
+ for (let y = 0; y < base.size; y++) for (let x = 0; x < base.size; x++) if (!fn[y][x] && MASKS[mask](x, y)) dark[y][x] = !dark[y][x];
270
+ drawFormat(dark, fn, base.size, level, mask);
271
+ return dark;
272
+ }
273
+ function encodeQr(text, level = "M") {
274
+ const bytes = utf8(text);
275
+ const version = smallestVersion(bytes, level);
276
+ const base = drawFunctionPatterns(version, level);
277
+ placeData(base, codewords(bytes, version, level));
278
+ const candidates = MASKS.map((_, mask) => masked(base, mask, level));
279
+ const scores = candidates.map(penalty);
280
+ return candidates[scores.indexOf(Math.min(...scores))];
281
+ }
282
+ function qrPath(matrix, quiet) {
283
+ const parts = [];
284
+ matrix.forEach((row, y) => {
285
+ for (let x = 0; x < row.length; x++) {
286
+ if (!row[x]) continue;
287
+ let end = x;
288
+ while (end + 1 < row.length && row[end + 1]) end++;
289
+ parts.push(`M${x + quiet} ${y + quiet}h${end - x + 1}v1h${x - end - 1}z`);
290
+ x = end;
291
+ }
292
+ });
293
+ return parts.join("");
294
+ }
295
+
296
+ // src/qr-code/qr-code.tsx
297
+ import * as React from "react";
298
+ import { jsx, jsxs } from "react/jsx-runtime";
299
+ var QR_TILE = "#ffffff";
300
+ var QR_MODULE = "#0b0f19";
301
+ function QrCode({ value, label, size = 176, quietZone = 4, level = "M", copyLabel, copiedLabel, onCopy, className }) {
302
+ const quiet = Math.max(2, Math.round(quietZone));
303
+ const { matrix, path } = React.useMemo(() => {
304
+ const m = encodeQr(value, level);
305
+ return { matrix: m, path: qrPath(m, quiet) };
306
+ }, [value, level, quiet]);
307
+ const modules = matrix.length + quiet * 2;
308
+ const [copied, setCopied] = React.useState(false);
309
+ React.useEffect(() => {
310
+ if (!copied) return;
311
+ const t = setTimeout(() => setCopied(false), 1800);
312
+ return () => clearTimeout(t);
313
+ }, [copied]);
314
+ const copy = () => navigator.clipboard?.writeText(value).then(() => {
315
+ setCopied(true);
316
+ onCopy?.();
317
+ });
318
+ return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex flex-col items-start gap-3", className), "data-qr-code": true, children: [
319
+ /* @__PURE__ */ jsxs(
320
+ "svg",
321
+ {
322
+ role: "img",
323
+ "aria-label": label,
324
+ viewBox: `0 0 ${modules} ${modules}`,
325
+ width: size,
326
+ height: size,
327
+ shapeRendering: "crispEdges",
328
+ className: "block max-w-full rounded-lg border border-border-default",
329
+ style: { height: "auto", aspectRatio: "1 / 1" },
330
+ children: [
331
+ /* @__PURE__ */ jsx("rect", { width: modules, height: modules, fill: QR_TILE }),
332
+ /* @__PURE__ */ jsx("path", { d: path, fill: QR_MODULE })
333
+ ]
334
+ }
335
+ ),
336
+ copyLabel ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "secondary", size: "sm", onClick: copy, announce: copied ? copiedLabel ?? copyLabel : void 0, children: [
337
+ copied ? /* @__PURE__ */ jsx(CheckGlyph, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(CopyGlyph, { className: "h-3.5 w-3.5" }),
338
+ copied ? copiedLabel ?? copyLabel : copyLabel
339
+ ] }) : null
340
+ ] });
341
+ }
342
+
343
+ export {
344
+ QrTooLongError,
345
+ encodeQr,
346
+ qrPath,
347
+ QrCode
348
+ };
349
+ //# sourceMappingURL=chunk-BCD2CRFG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/qr-code/encode.ts","../src/qr-code/qr-code.tsx"],"sourcesContent":["// The QR encoder: a string in, a square of dark/light modules out. Pure, offline, no dependency, shared by the web\n// and the native drawing. Byte mode (UTF-8), versions 1-40, the four error-correction levels, the eight masks chosen\n// by the standard's penalty rules (ISO/IEC 18004). `qr-code.test.tsx` decodes what it draws, version by version.\n\nexport type QrLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/** The square of modules, row by row: `true` is dark. */\nexport type QrMatrix = readonly (readonly boolean[])[];\n\nconst LEVEL_INDEX: Record<QrLevel, number> = { L: 0, M: 1, Q: 2, H: 3 };\nconst LEVEL_BITS: Record<QrLevel, number> = { L: 1, M: 0, Q: 3, H: 2 };\n\n// Error-correction codewords per block, and number of blocks, by level (L, M, Q, H) then version (index 0 is unused).\nconst ECC_PER_BLOCK = [\n [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n] as const;\nconst BLOCKS = [\n [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81],\n] as const;\n\n/** Data modules of a version (everything but the finder, timing, alignment, format and version patterns). */\nfunction rawModules(version: number): number {\n let result = (16 * version + 128) * version + 64;\n if (version >= 2) {\n const align = Math.floor(version / 7) + 2;\n result -= (25 * align - 10) * align - 55;\n if (version >= 7) result -= 36;\n }\n return result;\n}\n\nfunction dataCodewords(version: number, level: QrLevel): number {\n const l = LEVEL_INDEX[level];\n return Math.floor(rawModules(version) / 8) - ECC_PER_BLOCK[l]![version]! * BLOCKS[l]![version]!;\n}\n\nexport function utf8(text: string): number[] {\n return [...new TextEncoder().encode(text)];\n}\n\n// Reed-Solomon over GF(256), polynomial 0x11D.\nfunction gfMultiply(x: number, y: number): number {\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = (z << 1) ^ ((z >>> 7) * 0x11d);\n z ^= ((y >>> i) & 1) * x;\n }\n return z;\n}\n\nfunction divisor(degree: number): number[] {\n const result = new Array<number>(degree).fill(0);\n result[degree - 1] = 1;\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < degree; j++) {\n result[j] = gfMultiply(result[j]!, root);\n if (j + 1 < degree) result[j] = result[j]! ^ result[j + 1]!;\n }\n root = gfMultiply(root, 0x02);\n }\n return result;\n}\n\nfunction remainder(data: readonly number[], div: readonly number[]): number[] {\n const result = div.map(() => 0);\n for (const b of data) {\n const factor = b ^ result.shift()!;\n result.push(0);\n div.forEach((coef, i) => {\n result[i] = result[i]! ^ gfMultiply(coef, factor);\n });\n }\n return result;\n}\n\nfunction pushBits(bits: number[], value: number, count: number) {\n for (let i = count - 1; i >= 0; i--) bits.push((value >>> i) & 1);\n}\n\n/** The codewords of the message: mode, length, bytes, terminator, padding, then blocks interleaved with their ECC. */\nfunction codewords(bytes: readonly number[], version: number, level: QrLevel): number[] {\n const bits: number[] = [];\n pushBits(bits, 0b0100, 4);\n pushBits(bits, bytes.length, version <= 9 ? 8 : 16);\n for (const b of bytes) pushBits(bits, b, 8);\n const capacity = dataCodewords(version, level) * 8;\n pushBits(bits, 0, Math.min(4, capacity - bits.length));\n pushBits(bits, 0, (8 - (bits.length % 8)) % 8);\n let pad = 0xec;\n while (bits.length < capacity) {\n pushBits(bits, pad, 8);\n pad ^= 0xec ^ 0x11;\n }\n const data: number[] = [];\n for (let i = 0; i < bits.length; i += 8) data.push(parseInt(bits.slice(i, i + 8).join(\"\"), 2));\n\n const l = LEVEL_INDEX[level];\n const blocks = BLOCKS[l]![version]!;\n const eccLen = ECC_PER_BLOCK[l]![version]!;\n const shortBlocks = blocks - (Math.floor(rawModules(version) / 8) % blocks);\n const shortLen = Math.floor(rawModules(version) / 8 / blocks) - eccLen;\n const div = divisor(eccLen);\n const parts: { data: number[]; ecc: number[] }[] = [];\n for (let i = 0, k = 0; i < blocks; i++) {\n const chunk = data.slice(k, k + shortLen + (i < shortBlocks ? 0 : 1));\n k += chunk.length;\n parts.push({ data: chunk, ecc: remainder(chunk, div) });\n }\n const out: number[] = [];\n for (let i = 0; i <= shortLen; i++) parts.forEach((p) => i < p.data.length && out.push(p.data[i]!));\n for (let i = 0; i < eccLen; i++) parts.forEach((p) => out.push(p.ecc[i]!));\n return out;\n}\n\nfunction alignmentPositions(version: number): number[] {\n if (version === 1) return [];\n const count = Math.floor(version / 7) + 2;\n const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;\n const result = [6];\n let pos = version * 4 + 10;\n while (result.length < count) {\n result.splice(1, 0, pos);\n pos -= step;\n }\n return result;\n}\n\ntype Grid = { size: number; dark: boolean[][]; fn: boolean[][] };\n\nfunction drawFunctionPatterns(version: number, level: QrLevel): Grid {\n const size = version * 4 + 17;\n const dark = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n const fn = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n const set = (x: number, y: number, on: boolean) => {\n dark[y]![x] = on;\n fn[y]![x] = true;\n };\n for (let i = 0; i < size; i++) {\n set(6, i, i % 2 === 0);\n set(i, 6, i % 2 === 0);\n }\n const finder = (cx: number, cy: number) => {\n for (let dy = -4; dy <= 4; dy++)\n for (let dx = -4; dx <= 4; dx++) {\n const x = cx + dx;\n const y = cy + dy;\n if (x < 0 || x >= size || y < 0 || y >= size) continue;\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n set(x, y, dist !== 2 && dist !== 4);\n }\n };\n finder(3, 3);\n finder(size - 4, 3);\n finder(3, size - 4);\n const align = alignmentPositions(version);\n align.forEach((cx, i) =>\n align.forEach((cy, j) => {\n if ((i === 0 && j === 0) || (i === 0 && j === align.length - 1) || (i === align.length - 1 && j === 0)) return;\n for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) set(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n }),\n );\n drawFormat(dark, fn, size, level, 0);\n if (version >= 7) {\n let rem = version;\n for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n const bits = (version << 12) | rem;\n for (let i = 0; i < 18; i++) {\n const on = ((bits >>> i) & 1) !== 0;\n const a = size - 11 + (i % 3);\n const b = Math.floor(i / 3);\n set(a, b, on);\n set(b, a, on);\n }\n }\n return { size, dark, fn };\n}\n\nfunction drawFormat(dark: boolean[][], fn: boolean[][], size: number, level: QrLevel, mask: number) {\n const data = (LEVEL_BITS[level] << 3) | mask;\n let rem = data;\n for (let i = 0; i < 10; i++) rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n const bits = ((data << 10) | rem) ^ 0x5412;\n const bit = (i: number) => ((bits >>> i) & 1) !== 0;\n const set = (x: number, y: number, on: boolean) => {\n dark[y]![x] = on;\n fn[y]![x] = true;\n };\n for (let i = 0; i <= 5; i++) set(8, i, bit(i));\n set(8, 7, bit(6));\n set(8, 8, bit(7));\n set(7, 8, bit(8));\n for (let i = 9; i < 15; i++) set(14 - i, 8, bit(i));\n for (let i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));\n for (let i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));\n set(8, size - 8, true);\n}\n\n/** The data modules in the standard's order: two-column strips from the right, up then down, skipping the timing column. */\nfunction* dataPositions(size: number): Generator<[number, number]> {\n for (let right = size - 1; right >= 1; right -= 2) {\n if (right === 6) right = 5;\n for (let vert = 0; vert < size; vert++) {\n const y = ((right + 1) & 2) === 0 ? size - 1 - vert : vert;\n yield [right, y];\n yield [right - 1, y];\n }\n }\n}\n\nfunction placeData(grid: Grid, data: readonly number[]) {\n const { size, dark, fn } = grid;\n let i = 0;\n for (const [x, y] of dataPositions(size)) {\n if (fn[y]![x] || i >= data.length * 8) continue;\n dark[y]![x] = ((data[i >>> 3]! >>> (7 - (i & 7))) & 1) !== 0;\n i++;\n }\n}\n\nconst MASKS: ((x: number, y: number) => boolean)[] = [\n (x, y) => (x + y) % 2 === 0,\n (_x, y) => y % 2 === 0,\n (x) => x % 3 === 0,\n (x, y) => (x + y) % 3 === 0,\n (x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,\n (x, y) => ((x * y) % 2) + ((x * y) % 3) === 0,\n (x, y) => (((x * y) % 2) + ((x * y) % 3)) % 2 === 0,\n (x, y) => (((x + y) % 2) + ((x * y) % 3)) % 2 === 0,\n];\n\ntype Dark = readonly (readonly boolean[])[];\n\n/** Rule 1: runs of five or more of one colour in a line (3, then 1 per module beyond). */\nfunction runPenalty(line: readonly boolean[]): number {\n let score = 0;\n let run = 1;\n for (let i = 1; i < line.length; i++) {\n run = line[i] === line[i - 1] ? run + 1 : 1;\n if (run === 5) score += 3;\n else if (run > 5) score++;\n }\n return score;\n}\n\n/** Rule 3: the finder-like pattern 1011101 with four light modules on one side, 40 each. */\nfunction finderPenalty(line: readonly boolean[]): number {\n const text = line.map((on) => (on ? \"1\" : \"0\")).join(\"\");\n let score = 0;\n for (const pattern of [\"00001011101\", \"10111010000\"]) {\n for (let at = text.indexOf(pattern); at >= 0; at = text.indexOf(pattern, at + 1)) score += 40;\n }\n return score;\n}\n\n/** Rule 2: 2x2 blocks of one colour, 3 each. */\nfunction blockPenalty(dark: Dark): number {\n let score = 0;\n for (let y = 0; y < dark.length - 1; y++)\n for (let x = 0; x < dark.length - 1; x++) {\n const c = dark[y]![x]!;\n if (c === dark[y]![x + 1] && c === dark[y + 1]![x] && c === dark[y + 1]![x + 1]) score += 3;\n }\n return score;\n}\n\n/** Rule 4: the share of dark modules away from 50 %, 10 per started 5 %. */\nfunction balancePenalty(dark: Dark): number {\n const size = dark.length;\n const total = dark.reduce((n, row) => n + row.filter(Boolean).length, 0);\n return (Math.ceil(Math.abs(total * 20 - size * size * 10) / (size * size)) - 1) * 10;\n}\n\nfunction penalty(dark: Dark): number {\n const columns = dark.map((_, x) => dark.map((row) => row[x]!));\n const lines = [...dark, ...columns];\n return lines.reduce((n, line) => n + runPenalty(line) + finderPenalty(line), 0) + blockPenalty(dark) + balancePenalty(dark);\n}\n\n/** Thrown when the text does not fit the biggest code (version 40) at the asked level. */\nexport class QrTooLongError extends Error {\n constructor(length: number, level: QrLevel) {\n super(`The text (${length} bytes) is too long for a QR code at level ${level}.`);\n this.name = \"QrTooLongError\";\n }\n}\n\n/** The smallest version whose data capacity holds the bytes (mode and length fields included). */\nfunction smallestVersion(bytes: readonly number[], level: QrLevel): number {\n for (let version = 1; version <= 40; version++) {\n if (4 + (version <= 9 ? 8 : 16) + bytes.length * 8 <= dataCodewords(version, level) * 8) return version;\n }\n throw new QrTooLongError(bytes.length, level);\n}\n\n/** The grid with one mask applied to its data modules and its format bits written. */\nfunction masked(base: Grid, mask: number, level: QrLevel): boolean[][] {\n const dark = base.dark.map((row) => [...row]);\n const fn = base.fn.map((row) => [...row]);\n for (let y = 0; y < base.size; y++) for (let x = 0; x < base.size; x++) if (!fn[y]![x] && MASKS[mask]!(x, y)) dark[y]![x] = !dark[y]![x];\n drawFormat(dark, fn, base.size, level, mask);\n return dark;\n}\n\n/** Encodes a text as a QR code: the smallest version that holds it at `level`, the best of the eight masks. */\nexport function encodeQr(text: string, level: QrLevel = \"M\"): QrMatrix {\n const bytes = utf8(text);\n const version = smallestVersion(bytes, level);\n const base = drawFunctionPatterns(version, level);\n placeData(base, codewords(bytes, version, level));\n const candidates = MASKS.map((_, mask) => masked(base, mask, level));\n const scores = candidates.map(penalty);\n return candidates[scores.indexOf(Math.min(...scores))]!;\n}\n\n/**\n * The drawing of a matrix as one SVG path: a rectangle per horizontal run of dark modules, in module units, offset by\n * the quiet zone. Shared by the web `<svg>` and the native `<Path>`.\n */\nexport function qrPath(matrix: QrMatrix, quiet: number): string {\n const parts: string[] = [];\n matrix.forEach((row, y) => {\n for (let x = 0; x < row.length; x++) {\n if (!row[x]) continue;\n let end = x;\n while (end + 1 < row.length && row[end + 1]) end++;\n parts.push(`M${x + quiet} ${y + quiet}h${end - x + 1}v1h${x - end - 1}z`);\n x = end;\n }\n });\n return parts.join(\"\");\n}\n","// Client (the copy action). A QR code drawn from a text, offline: an SVG of dark modules on a light tile, whatever the\n// theme (a phone reads dark on light), with its quiet zone. No call to any service; the text never leaves the page.\nimport * as React from \"react\";\n\nimport { Button } from \"../button/button\";\nimport { cn } from \"../cn\";\nimport { CheckGlyph, CopyGlyph } from \"../glyphs\";\nimport { encodeQr, type QrLevel, qrPath } from \"./encode\";\n\n// The tile and the modules are the same in dark and light on purpose: a scanner needs dark modules on a light ground.\nexport const QR_TILE = \"#ffffff\";\nexport const QR_MODULE = \"#0b0f19\";\n\nexport type QrCodeProps = {\n /** The text to encode — an address, a feed URL. Encoded here, in the browser (or on the server); never sent anywhere. */\n value: string;\n /** What the code is, for a screen reader (“Calendar feed — scan with your phone”), passed translated. The image is named by it. */\n label: string;\n /** The side of the tile, in px, quiet zone included. Default 176. */\n size?: number;\n /** The quiet zone, in modules, around the code (the standard asks for 4). Default 4, never less than 2. */\n quietZone?: number;\n /** The error-correction level: L · M (default) · Q · H (a logo or wear on the print). */\n level?: QrLevel;\n /** The words of the copy action, passed translated. Without them there is no « copy » button. */\n copyLabel?: string;\n /** Said once the text is on the clipboard. Default: the copy label. */\n copiedLabel?: string;\n /** Called after the text is copied. */\n onCopy?: () => void;\n /** Classes merged last, on the wrapper. */\n className?: string;\n};\n\n/** A QR code from a text: dark modules on a light tile in both themes, a quiet zone, an accessible name, an optional copy action. */\nexport function QrCode({ value, label, size = 176, quietZone = 4, level = \"M\", copyLabel, copiedLabel, onCopy, className }: QrCodeProps) {\n const quiet = Math.max(2, Math.round(quietZone));\n const { matrix, path } = React.useMemo(() => {\n const m = encodeQr(value, level);\n return { matrix: m, path: qrPath(m, quiet) };\n }, [value, level, quiet]);\n const modules = matrix.length + quiet * 2;\n const [copied, setCopied] = React.useState(false);\n React.useEffect(() => {\n if (!copied) return;\n const t = setTimeout(() => setCopied(false), 1800);\n return () => clearTimeout(t);\n }, [copied]);\n const copy = () =>\n navigator.clipboard?.writeText(value).then(() => {\n setCopied(true);\n onCopy?.();\n });\n\n return (\n <div className={cn(\"inline-flex flex-col items-start gap-3\", className)} data-qr-code>\n <svg\n role=\"img\"\n aria-label={label}\n viewBox={`0 0 ${modules} ${modules}`}\n width={size}\n height={size}\n shapeRendering=\"crispEdges\"\n className=\"block max-w-full rounded-lg border border-border-default\"\n style={{ height: \"auto\", aspectRatio: \"1 / 1\" }}\n >\n <rect width={modules} height={modules} fill={QR_TILE} />\n <path d={path} fill={QR_MODULE} />\n </svg>\n {copyLabel ? (\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={copy} announce={copied ? (copiedLabel ?? copyLabel) : undefined}>\n {copied ? <CheckGlyph className=\"h-3.5 w-3.5\" /> : <CopyGlyph className=\"h-3.5 w-3.5\" />}\n {copied ? (copiedLabel ?? copyLabel) : copyLabel}\n </Button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AASA,IAAM,cAAuC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AACtE,IAAM,aAAsC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAGrE,IAAM,gBAAgB;AAAA,EACpB,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AAAA,EAClK,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,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AAA,IAClC;AAAA,IACC,YACC,qBAAC,UAAO,MAAK,UAAS,SAAQ,aAAY,MAAK,MAAK,SAAS,MAAM,UAAU,SAAU,eAAe,YAAa,QAChH;AAAA,eAAS,oBAAC,cAAW,WAAU,eAAc,IAAK,oBAAC,aAAU,WAAU,eAAc;AAAA,MACrF,SAAU,eAAe,YAAa;AAAA,OACzC,IACE;AAAA,KACN;AAEJ;","names":[]}
@@ -1,17 +1,4 @@
1
1
  "use client";
2
- import {
3
- ProductLogo
4
- } from "./chunk-PGPNYYE2.js";
5
-
6
- // src/family-mark.tsx
7
- import { jsx } from "react/jsx-runtime";
8
- function GitHubGlyph({ size = 16, className }) {
9
- return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", width: size, height: size, fill: "currentColor", "aria-hidden": true, className, children: /* @__PURE__ */ jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z" }) });
10
- }
11
- function FamilyMark({ mark, size }) {
12
- if (mark === "github") return /* @__PURE__ */ jsx(GitHubGlyph, { size: Math.round(size * 0.8) });
13
- return /* @__PURE__ */ jsx(ProductLogo, { id: mark, size, animated: false });
14
- }
15
2
 
16
3
  // src/sites/sites.ts
17
4
  var site = (s) => ({ ...s, host: s.url.replace(/^https?:\/\//, "").replace(/\/$/, "") });
@@ -89,11 +76,11 @@ var familyLabels = {
89
76
  };
90
77
 
91
78
  export {
92
- GitHubGlyph,
93
- FamilyMark,
79
+ sites,
80
+ siteGroups,
94
81
  siteById,
95
82
  sitesByGroup,
96
83
  companyLinks,
97
84
  familyLabels
98
85
  };
99
- //# sourceMappingURL=chunk-SG3QJJXE.js.map
86
+ //# sourceMappingURL=chunk-ENFXJUDN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sites/sites.ts"],"sourcesContent":["// Server-safe: plain data. The Krizaka family — every site Krizaka runs, once. The family switcher of the bar\n// (`NavBar.Family`) and the common footer (`SiteFooter`) both read it, so adding a site is one release of this package:\n// every bar and every footer of the family follow.\n//\n// The words of the family (a site's one line, the groups, the statuses, the footer's signature) are brand data, written\n// here in English and French (`familyLabels`) — a site passes the set of its locale, or its own translation.\n\n/** A site of the family. */\nexport type SiteId = \"krizaka\" | \"orazaka\" | \"yomizaka\" | \"akinaza\" | \"ui\" | \"java\" | \"ts\" | \"motion\" | \"github\";\n\n/** What a site is: the company, a product, or an open-source project. It chooses the footer's signature line. */\nexport type SiteKind = \"company\" | \"product\" | \"open-source\";\n\n/**\n * `released`: open to visit. `upcoming`: announced, not released yet (said \"Coming soon\"). `construction`: under\n * construction — nothing offered (a QA-only app may run; the public page says so). `development`: being built in the\n * open, with a dev site (said \"In development\"). A site with none yet would use its repository as its address.\n */\nexport type SiteStatus = \"released\" | \"upcoming\" | \"construction\" | \"development\";\n\n/** The groups of the family, in reading order: Krizaka · Products · Open source · GitHub. */\nexport type SiteGroup = \"krizaka\" | \"products\" | \"open-source\" | \"github\";\n\n/** The mark a site wears: a brand of `ProductLogo` (Krizaka UI and Krizaka Java wear Krizaka's), or GitHub's. */\nexport type SiteMark = \"krizaka\" | \"orazaka\" | \"yomizaka\" | \"akinaza\" | \"github\";\n\nexport interface Site {\n readonly id: SiteId;\n /** The name, never translated. */\n readonly name: string;\n /** The address of the site (its home). */\n readonly url: string;\n /** The address without the scheme, as people say it (`ui.krizaka.com`). */\n readonly host: string;\n readonly kind: SiteKind;\n readonly group: SiteGroup;\n readonly status: SiteStatus;\n readonly mark: SiteMark;\n /** The repository the site is built from. */\n readonly repo: string;\n}\n\nconst site = (s: Omit<Site, \"host\">): Site => ({ ...s, host: s.url.replace(/^https?:\\/\\//, \"\").replace(/\\/$/, \"\") });\n\n/** Every site of the family, in reading order (the group order, then the order inside each group). */\nexport const sites: readonly Site[] = [\n site({ id: \"krizaka\", name: \"Krizaka\", url: \"https://www.krizaka.com\", kind: \"company\", group: \"krizaka\", status: \"released\", mark: \"krizaka\", repo: \"https://github.com/krizaka/krizaka-com\" }),\n site({ id: \"orazaka\", name: \"Orazaka\", url: \"https://www.orazaka.com\", kind: \"product\", group: \"products\", status: \"released\", mark: \"orazaka\", repo: \"https://github.com/krizaka/orazaka\" }),\n site({ id: \"yomizaka\", name: \"Yomizaka\", url: \"https://www.yomizaka.com\", kind: \"product\", group: \"products\", status: \"development\", mark: \"yomizaka\", repo: \"https://github.com/krizaka/yomizaka\" }),\n site({ id: \"akinaza\", name: \"Akinaza\", url: \"https://www.akinaza.com\", kind: \"product\", group: \"products\", status: \"development\", mark: \"akinaza\", repo: \"https://github.com/krizaka/akinaza\" }),\n site({ id: \"ui\", name: \"Krizaka UI\", url: \"https://ui.krizaka.com\", kind: \"open-source\", group: \"open-source\", status: \"released\", mark: \"krizaka\", repo: \"https://github.com/krizaka/krizaka-ui\" }),\n site({ id: \"java\", name: \"Krizaka Java\", url: \"https://java.krizaka.com\", kind: \"open-source\", group: \"open-source\", status: \"released\", mark: \"krizaka\", repo: \"https://github.com/krizaka/krizaka-build\" }),\n site({ id: \"ts\", name: \"Krizaka TypeScript\", url: \"https://ts.krizaka.com\", kind: \"open-source\", group: \"open-source\", status: \"released\", mark: \"krizaka\", repo: \"https://github.com/krizaka/krizaka-ts\" }),\n // The family lab: built in the open, served at lab.krizaka.com; what proves itself there moves into Krizaka UI.\n site({ id: \"motion\", name: \"Krizaka Lab\", url: \"https://lab.krizaka.com\", kind: \"open-source\", group: \"open-source\", status: \"development\", mark: \"krizaka\", repo: \"https://github.com/krizaka/krizaka-lab\" }),\n site({ id: \"github\", name: \"GitHub\", url: \"https://github.com/krizaka\", kind: \"open-source\", group: \"github\", status: \"released\", mark: \"github\", repo: \"https://github.com/krizaka\" }),\n];\n\n/** The groups, in reading order. */\nexport const siteGroups: readonly SiteGroup[] = [\"krizaka\", \"products\", \"open-source\", \"github\"];\n\n/** A site by id. */\nexport function siteById(id: SiteId): Site {\n const found = sites.find((s) => s.id === id);\n if (!found) throw new Error(`Unknown Krizaka site \"${id}\".`);\n return found;\n}\n\n/** The family grouped, in reading order: `[{ group, sites }]`, empty groups left out. */\nexport function sitesByGroup(): { group: SiteGroup; sites: Site[] }[] {\n return siteGroups.map((group) => ({ group, sites: sites.filter((s) => s.group === group) })).filter((g) => g.sites.length > 0);\n}\n\n/** The languages the family's words are written in. */\nexport type SiteLocale = \"en\" | \"fr\";\n\n/** The company's own pages, the footer's « Krizaka » column (the brand's home is the signature line's link). */\nexport type CompanyLinkId = \"story\" | \"blog\" | \"contact\";\nexport const companyLinks: readonly { id: CompanyLinkId; url: Record<SiteLocale, string> }[] = [\n { id: \"story\", url: { en: \"https://www.krizaka.com/story\", fr: \"https://www.krizaka.com/fr/story\" } },\n { id: \"blog\", url: { en: \"https://blog.krizaka.com\", fr: \"https://blog.krizaka.com\" } },\n { id: \"contact\", url: { en: \"https://www.krizaka.com/contact\", fr: \"https://www.krizaka.com/fr/contact\" } },\n];\n\n/** The words of the family: the switcher, the footer, each site's one line. */\nexport interface FamilyLabels {\n /** The family's name: the switcher's navigation and its button, the footer's navigation (“Krizaka family”). */\n family: string;\n /** The heading of each group. */\n groups: Record<SiteGroup, string>;\n /** The badge of a site that is not released. */\n status: Record<Exclude<SiteStatus, \"released\">, string>;\n /** Says which site is the current one (“You are here”). */\n current: string;\n /** One line per site: what it is. */\n descriptions: Record<SiteId, string>;\n /** The footer's signature, by the kind of the current site (“A Krizaka product”). */\n signature: Record<SiteKind, string>;\n /** The footer's place line (“Made in Montréal”). */\n place: string;\n /** The accessible name of the version (“Version”). */\n version: string;\n /** The language of these words: the company links open in it. @default \"en\" */\n lang?: SiteLocale;\n /** The company's pages in the footer's « Krizaka » column. @default the English words */\n company?: Record<CompanyLinkId, string>;\n}\n\n/** The family's words in English and French. Pass `familyLabels[locale]`, or your own translation of the same shape. */\nexport const familyLabels: Record<SiteLocale, FamilyLabels> = {\n en: {\n family: \"Krizaka family\",\n groups: { krizaka: \"Krizaka\", products: \"Products\", \"open-source\": \"Open source\", github: \"GitHub\" },\n status: { upcoming: \"Coming soon\", construction: \"Under construction\", development: \"In development\" },\n current: \"You are here\",\n descriptions: {\n krizaka: \"The company: our products, our open source, our story.\",\n orazaka: \"Sovereign AI on your own servers: chat, documents, images and video — and the engine under the other products.\",\n yomizaka: \"Yomizaka reads your leases, contracts and invoices.\",\n akinaza: \"Running a shop in Québec, for less — Loi 25 by design.\",\n ui: \"Components, tokens, icons and charts — web and React Native.\",\n java: \"Spring Boot building blocks on Maven Central.\",\n ts: \"TypeScript backend building blocks on npm.\",\n motion: \"The family lab: the kit's motion, played live with its knobs.\",\n github: \"Every repository, in the open.\",\n },\n signature: { company: \"A Krizaka company\", product: \"A Krizaka product\", \"open-source\": \"A Krizaka open-source project\" },\n place: \"Made in Montréal\",\n version: \"Version\",\n lang: \"en\",\n company: { story: \"Our story\", blog: \"Blog\", contact: \"Contact us\" },\n },\n fr: {\n family: \"Famille Krizaka\",\n groups: { krizaka: \"Krizaka\", products: \"Produits\", \"open-source\": \"Open source\", github: \"GitHub\" },\n status: { upcoming: \"Bientôt\", construction: \"En construction\", development: \"En développement\" },\n current: \"Vous êtes ici\",\n descriptions: {\n krizaka: \"La compagnie : nos produits, notre open source, notre histoire.\",\n orazaka: \"L’IA souveraine sur vos propres serveurs : conversation, documents, images et vidéo — et le moteur des autres produits.\",\n yomizaka: \"Yomizaka lit vos baux, contrats et factures.\",\n akinaza: \"Tenir une boutique au Québec, pour moins cher — Loi 25 dès la conception.\",\n ui: \"Composants, jetons, icônes et graphiques — web et React Native.\",\n java: \"Des briques Spring Boot sur Maven Central.\",\n ts: \"Des briques backend TypeScript sur npm.\",\n motion: \"Le labo du mouvement : le mouvement du kit, joué en direct, avec ses réglages.\",\n github: \"Tous les dépôts, au grand jour.\",\n },\n signature: { company: \"Une compagnie Krizaka\", product: \"Un produit Krizaka\", \"open-source\": \"Un projet open source de Krizaka\" },\n place: \"Fait à Montréal\",\n version: \"Version\",\n lang: \"fr\",\n company: { story: \"Notre histoire\", blog: \"Blogue\", contact: \"Nous écrire\" },\n },\n};\n\n/**\n * What the footer and the bar read from `@krizaka/org` (the organisation's public facts, one validated JSON): the brand's\n * name, the footer line and the legal links, each in both languages. Structural: the whole `Org` of `@krizaka/org` fits.\n */\nexport interface OrgFacts {\n brand: { name: string };\n /**\n * Every name of the family (`org.family` of `@krizaka/org`, krizaka/krizaka-internal#754): when given, the footer reads\n * the names and addresses here, never from this package's registry — the company « Krizaka », products by their own\n * name, libraries « Krizaka <X> ».\n */\n family?: readonly OrgFamilyEntry[];\n footer: {\n /** « Une entreprise de Technologies Krizaka · Fait à Montréal ». */\n line: Record<SiteLocale, string>;\n legal: readonly { id: string; label: Record<SiteLocale, string>; url: Record<SiteLocale, string> }[];\n };\n}\n\n/** One entry of `org.family` (`@krizaka/org`), the part the footer reads. */\nexport interface OrgFamilyEntry {\n id: string;\n name: string;\n group: SiteGroup;\n status: \"released\" | \"development\";\n url: string;\n}\n\n/** The family's words with the organisation's facts in them: the place line is the org's, not a copy. */\nexport function orgFamilyLabels(org: OrgFacts, locale: SiteLocale): FamilyLabels {\n return { ...familyLabels[locale], place: org.footer.line[locale] };\n}\n"],"mappings":";;;AA0CA,IAAM,OAAO,CAAC,OAAiC,EAAE,GAAG,GAAG,MAAM,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S;AAAA,IACT,MAAM;AAAA,IACN,SAAS,EAAE,OAAO,aAAa,MAAM,QAAQ,SAAS,aAAa;AAAA,EACrE;AAAA,EACA,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,QAAQ,EAAE,SAAS,WAAW,UAAU,YAAY,eAAe,eAAe,QAAQ,SAAS;AAAA,IACnG,QAAQ,EAAE,UAAU,cAAW,cAAc,mBAAmB,aAAa,sBAAmB;AAAA,IAChG,SAAS;AAAA,IACT,cAAc;AAAA,MACZ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,IACA,WAAW,EAAE,SAAS,yBAAyB,SAAS,sBAAsB,eAAe,mCAAmC;AAAA,IAChI,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS,EAAE,OAAO,kBAAkB,MAAM,UAAU,SAAS,iBAAc;AAAA,EAC7E;AACF;","names":[]}
@@ -83,11 +83,11 @@ declare const filterBar: tailwind_variants.TVReturnType<{
83
83
  [key: string]: {
84
84
  [key: string]: tailwind_variants.ClassValue | {
85
85
  root?: tailwind_variants.ClassValue;
86
- count?: tailwind_variants.ClassValue;
87
86
  controls?: tailwind_variants.ClassValue;
88
87
  active?: tailwind_variants.ClassValue;
89
88
  clear?: tailwind_variants.ClassValue;
90
89
  results?: tailwind_variants.ClassValue;
90
+ count?: tailwind_variants.ClassValue;
91
91
  optionCount?: tailwind_variants.ClassValue;
92
92
  trigger?: tailwind_variants.ClassValue;
93
93
  };
@@ -96,11 +96,11 @@ declare const filterBar: tailwind_variants.TVReturnType<{
96
96
  [x: string]: {
97
97
  [x: string]: tailwind_variants.ClassValue | {
98
98
  root?: tailwind_variants.ClassValue;
99
- count?: tailwind_variants.ClassValue;
100
99
  controls?: tailwind_variants.ClassValue;
101
100
  active?: tailwind_variants.ClassValue;
102
101
  clear?: tailwind_variants.ClassValue;
103
102
  results?: tailwind_variants.ClassValue;
103
+ count?: tailwind_variants.ClassValue;
104
104
  optionCount?: tailwind_variants.ClassValue;
105
105
  trigger?: tailwind_variants.ClassValue;
106
106
  };
@@ -118,11 +118,11 @@ declare const filterBar: tailwind_variants.TVReturnType<{
118
118
  [key: string]: {
119
119
  [key: string]: tailwind_variants.ClassValue | {
120
120
  root?: tailwind_variants.ClassValue;
121
- count?: tailwind_variants.ClassValue;
122
121
  controls?: tailwind_variants.ClassValue;
123
122
  active?: tailwind_variants.ClassValue;
124
123
  clear?: tailwind_variants.ClassValue;
125
124
  results?: tailwind_variants.ClassValue;
125
+ count?: tailwind_variants.ClassValue;
126
126
  optionCount?: tailwind_variants.ClassValue;
127
127
  trigger?: tailwind_variants.ClassValue;
128
128
  };
@@ -0,0 +1,39 @@
1
+ import * as React from 'react';
2
+
3
+ interface IdentityCardQr {
4
+ /** The text to encode: a vCard (`vCard(fields)` of `@krizaka/ui/qr-code`), an address. */
5
+ value: string;
6
+ /** What the code is, for a screen reader (“Contact card: scan to add the business to your phone”), passed translated. */
7
+ label: string;
8
+ /** One line under the code (“Scan to add the contact”), passed translated. */
9
+ lead?: React.ReactNode;
10
+ /** The words of the copy action (“Copy the vCard”); without them the code has no copy button. */
11
+ copyLabel?: string;
12
+ copiedLabel?: string;
13
+ /** The side of the tile, in px. @default 132 */
14
+ size?: number;
15
+ }
16
+ type IdentityCardProps = Omit<React.HTMLAttributes<HTMLElement>, "title"> & {
17
+ /** The mark: a logo, an avatar. Decorative — the name carries the meaning. */
18
+ mark: React.ReactNode;
19
+ /** A small line above the name (“Business card”), passed translated. */
20
+ eyebrow?: React.ReactNode;
21
+ /** The name: the legal name of the business, the person's name. It is the card's heading. */
22
+ name: React.ReactNode;
23
+ /**
24
+ * The level of the name.
25
+ * @default "h2"
26
+ */
27
+ nameAs?: "h1" | "h2" | "h3" | "p";
28
+ /** What it is called day to day, its legal form: “Salon Cèdre & Ciseaux · Incorporated”. */
29
+ subtitle?: React.ReactNode;
30
+ /** Under the subtitle, in a row that wraps: a status chip, the registration number as a mono chip, the city. */
31
+ chips?: React.ReactNode;
32
+ /** A QR code at the end (under the text on a phone): the contact as a phone can read it. */
33
+ qr?: IdentityCardQr;
34
+ };
35
+ /** The identity of a business or a person: mark, name, subtitle, chips and a contact QR code. Wraps to one column on a phone. */
36
+ declare function IdentityCard({ mark, eyebrow, name, nameAs: Name, subtitle, chips, qr, className, ...props }: IdentityCardProps): React.JSX.Element;
37
+
38
+ export { IdentityCard };
39
+ export type { IdentityCardProps, IdentityCardQr };
@@ -0,0 +1,34 @@
1
+ import {
2
+ QrCode
3
+ } from "./chunk-BCD2CRFG.js";
4
+ import "./chunk-C57KK5VB.js";
5
+ import "./chunk-EB45EVPJ.js";
6
+ import "./chunk-43PTCDTL.js";
7
+ import "./chunk-2VNYHG4E.js";
8
+ import {
9
+ cn
10
+ } from "./chunk-W675RFOA.js";
11
+
12
+ // src/identity-card/identity-card.tsx
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ function IdentityCard({ mark, eyebrow, name, nameAs: Name = "h2", subtitle, chips, qr, className, ...props }) {
15
+ return /* @__PURE__ */ jsxs("section", { "data-slot": "identity-card", className: cn("flex flex-wrap items-center justify-between gap-6 rounded-lg border border-border-default bg-surface-1 p-5 text-fg sm:p-6", className), ...props, children: [
16
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-4 sm:gap-5", children: [
17
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "shrink-0", children: mark }),
18
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
19
+ eyebrow ? /* @__PURE__ */ jsx("p", { className: "font-mono text-xs text-fg-secondary", children: eyebrow }) : null,
20
+ /* @__PURE__ */ jsx(Name, { className: "font-display text-2xl font-bold text-fg sm:text-3xl [overflow-wrap:anywhere]", children: name }),
21
+ subtitle ? /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-fg-secondary", children: subtitle }) : null,
22
+ chips ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: chips }) : null
23
+ ] })
24
+ ] }),
25
+ qr ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
26
+ /* @__PURE__ */ jsx(QrCode, { value: qr.value, label: qr.label, size: qr.size ?? 132, copyLabel: qr.copyLabel, copiedLabel: qr.copiedLabel }),
27
+ qr.lead ? /* @__PURE__ */ jsx("p", { className: "max-w-[11rem] text-center text-xs text-fg-secondary", children: qr.lead }) : null
28
+ ] }) : null
29
+ ] });
30
+ }
31
+ export {
32
+ IdentityCard
33
+ };
34
+ //# sourceMappingURL=identity-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/identity-card/identity-card.tsx"],"sourcesContent":["// Client (its QR code copies). The identity of a business, a person or an organisation at the top of a sheet: the mark, the name\n// and what it is called, chips for its status and its registration number, and a QR code that hands the contact to a phone.\nimport type * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { QrCode } from \"../qr-code/qr-code\";\n\nexport interface IdentityCardQr {\n /** The text to encode: a vCard (`vCard(fields)` of `@krizaka/ui/qr-code`), an address. */\n value: string;\n /** What the code is, for a screen reader (“Contact card: scan to add the business to your phone”), passed translated. */\n label: string;\n /** One line under the code (“Scan to add the contact”), passed translated. */\n lead?: React.ReactNode;\n /** The words of the copy action (“Copy the vCard”); without them the code has no copy button. */\n copyLabel?: string;\n copiedLabel?: string;\n /** The side of the tile, in px. @default 132 */\n size?: number;\n}\n\nexport type IdentityCardProps = Omit<React.HTMLAttributes<HTMLElement>, \"title\"> & {\n /** The mark: a logo, an avatar. Decorative — the name carries the meaning. */\n mark: React.ReactNode;\n /** A small line above the name (“Business card”), passed translated. */\n eyebrow?: React.ReactNode;\n /** The name: the legal name of the business, the person's name. It is the card's heading. */\n name: React.ReactNode;\n /**\n * The level of the name.\n * @default \"h2\"\n */\n nameAs?: \"h1\" | \"h2\" | \"h3\" | \"p\";\n /** What it is called day to day, its legal form: “Salon Cèdre & Ciseaux · Incorporated”. */\n subtitle?: React.ReactNode;\n /** Under the subtitle, in a row that wraps: a status chip, the registration number as a mono chip, the city. */\n chips?: React.ReactNode;\n /** A QR code at the end (under the text on a phone): the contact as a phone can read it. */\n qr?: IdentityCardQr;\n};\n\n/** The identity of a business or a person: mark, name, subtitle, chips and a contact QR code. Wraps to one column on a phone. */\nexport function IdentityCard({ mark, eyebrow, name, nameAs: Name = \"h2\", subtitle, chips, qr, className, ...props }: IdentityCardProps) {\n return (\n <section data-slot=\"identity-card\" className={cn(\"flex flex-wrap items-center justify-between gap-6 rounded-lg border border-border-default bg-surface-1 p-5 text-fg sm:p-6\", className)} {...props}>\n <div className=\"flex min-w-0 flex-1 items-center gap-4 sm:gap-5\">\n <div aria-hidden=\"true\" className=\"shrink-0\">{mark}</div>\n <div className=\"min-w-0\">\n {eyebrow ? <p className=\"font-mono text-xs text-fg-secondary\">{eyebrow}</p> : null}\n <Name className=\"font-display text-2xl font-bold text-fg sm:text-3xl [overflow-wrap:anywhere]\">{name}</Name>\n {subtitle ? <p className=\"mt-1 text-sm text-fg-secondary\">{subtitle}</p> : null}\n {chips ? <div className=\"mt-4 flex flex-wrap items-center gap-2\">{chips}</div> : null}\n </div>\n </div>\n {qr ? (\n <div className=\"flex flex-col items-center gap-2\">\n <QrCode value={qr.value} label={qr.label} size={qr.size ?? 132} copyLabel={qr.copyLabel} copiedLabel={qr.copiedLabel} />\n {qr.lead ? <p className=\"max-w-[11rem] text-center text-xs text-fg-secondary\">{qr.lead}</p> : null}\n </div>\n ) : null}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA8CQ,cACA,YADA;AAJD,SAAS,aAAa,EAAE,MAAM,SAAS,MAAM,QAAQ,OAAO,MAAM,UAAU,OAAO,IAAI,WAAW,GAAG,MAAM,GAAsB;AACtI,SACE,qBAAC,aAAQ,aAAU,iBAAgB,WAAW,GAAG,6HAA6H,SAAS,GAAI,GAAG,OAC5L;AAAA,yBAAC,SAAI,WAAU,mDACb;AAAA,0BAAC,SAAI,eAAY,QAAO,WAAU,YAAY,gBAAK;AAAA,MACnD,qBAAC,SAAI,WAAU,WACZ;AAAA,kBAAU,oBAAC,OAAE,WAAU,uCAAuC,mBAAQ,IAAO;AAAA,QAC9E,oBAAC,QAAK,WAAU,gFAAgF,gBAAK;AAAA,QACpG,WAAW,oBAAC,OAAE,WAAU,kCAAkC,oBAAS,IAAO;AAAA,QAC1E,QAAQ,oBAAC,SAAI,WAAU,0CAA0C,iBAAM,IAAS;AAAA,SACnF;AAAA,OACF;AAAA,IACC,KACC,qBAAC,SAAI,WAAU,oCACb;AAAA,0BAAC,UAAO,OAAO,GAAG,OAAO,OAAO,GAAG,OAAO,MAAM,GAAG,QAAQ,KAAK,WAAW,GAAG,WAAW,aAAa,GAAG,aAAa;AAAA,MACrH,GAAG,OAAO,oBAAC,OAAE,WAAU,uDAAuD,aAAG,MAAK,IAAO;AAAA,OAChG,IACE;AAAA,KACN;AAEJ;","names":[]}
package/dist/nav-bar.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as tailwind_variants from 'tailwind-variants';
2
2
  import { NavigationMenu } from 'radix-ui';
3
3
  import * as React from 'react';
4
4
  import { LanguageSwitchProps } from './language-switch.js';
5
- import { O as OrgFacts, S as SiteId, F as FamilyLabels } from './sites-CVNSirrg.js';
5
+ import { O as OrgFacts, S as SiteId, F as FamilyLabels } from './sites-BLqbwmng.js';
6
6
 
7
7
  /** The body of `GET /api/me`. `account` is the product's own shape, present only when `signedIn`. */
8
8
  interface MeResponse<TAccount = unknown> {