@krizaka/ui 3.67.1 → 3.69.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 (301) hide show
  1. package/README.md +1 -0
  2. package/dist/chunk-E4FMPPDL.js +134 -0
  3. package/dist/chunk-E4FMPPDL.js.map +1 -0
  4. package/dist/{chunk-E4X3V7QX.js → chunk-GRVIZTT2.js} +2 -2
  5. package/dist/chunk-PZ4FJOD5.js +44 -0
  6. package/dist/chunk-PZ4FJOD5.js.map +1 -0
  7. package/dist/{chunk-PFPOBIHL.js → chunk-T5NZSKWT.js} +15 -12
  8. package/dist/{chunk-PFPOBIHL.js.map → chunk-T5NZSKWT.js.map} +1 -1
  9. package/dist/{chunk-6BMKLAZ7.js → chunk-Z47KIPCT.js} +7 -2
  10. package/dist/{chunk-6BMKLAZ7.js.map → chunk-Z47KIPCT.js.map} +1 -1
  11. package/dist/copy-button.d.ts +29 -0
  12. package/dist/copy-button.js +56 -0
  13. package/dist/copy-button.js.map +1 -0
  14. package/dist/data-table.js +3 -3
  15. package/dist/date-picker.d.ts +15 -15
  16. package/dist/filter-bar.d.ts +3 -3
  17. package/dist/filter-bar.js +1 -1
  18. package/dist/genui.js +3 -3
  19. package/dist/index.js +3 -3
  20. package/dist/kind-config-editor.js +106 -129
  21. package/dist/kind-config-editor.js.map +1 -1
  22. package/dist/lightbox-D5NAHFEA.js +95 -0
  23. package/dist/lightbox-D5NAHFEA.js.map +1 -0
  24. package/dist/match-dialog.js +17 -140
  25. package/dist/match-dialog.js.map +1 -1
  26. package/dist/money-input.d.ts +29 -0
  27. package/dist/money-input.js +78 -0
  28. package/dist/money-input.js.map +1 -0
  29. package/dist/nav-bar.d.ts +28 -4
  30. package/dist/nav-bar.js +20 -10
  31. package/dist/nav-bar.js.map +1 -1
  32. package/dist/promo-code-field.d.ts +38 -0
  33. package/dist/promo-code-field.js +94 -0
  34. package/dist/promo-code-field.js.map +1 -0
  35. package/dist/radio-group.js +1 -1
  36. package/dist/retro-tv.d.ts +39 -4
  37. package/dist/retro-tv.js +217 -40
  38. package/dist/retro-tv.js.map +1 -1
  39. package/dist/shop/booking.d.ts +22 -3
  40. package/dist/shop/booking.js +33 -1
  41. package/dist/shop/booking.js.map +1 -1
  42. package/dist/shop-composer.d.ts +1 -1
  43. package/dist/shop-composer.js +109 -85
  44. package/dist/shop-composer.js.map +1 -1
  45. package/dist/shop-gallery.d.ts +47 -0
  46. package/dist/shop-gallery.js +121 -0
  47. package/dist/shop-gallery.js.map +1 -0
  48. package/dist/shop.d.ts +1 -1
  49. package/dist/shop.js +1 -1
  50. package/dist/shop.js.map +1 -1
  51. package/dist/status-chip.js +1 -1
  52. package/dist/tag-selector.js +5 -5
  53. package/dist/tag-selector.js.map +1 -1
  54. package/dist/terminal-replay.js +1 -1
  55. package/dist/virtual.d.ts +3 -3
  56. package/package.json +63 -5
  57. package/registry/account-menu.json +1 -1
  58. package/registry/account-settings.json +1 -1
  59. package/registry/achievement.json +1 -1
  60. package/registry/action-bar.json +1 -1
  61. package/registry/activity-feed.json +1 -1
  62. package/registry/agenda.json +1 -1
  63. package/registry/alert.json +1 -1
  64. package/registry/analysis-report.json +1 -1
  65. package/registry/anatomy-plate.json +1 -1
  66. package/registry/app-frame.json +2 -2
  67. package/registry/app-header.json +1 -1
  68. package/registry/app-shell.json +1 -1
  69. package/registry/argument-card.json +1 -1
  70. package/registry/audio-player.json +1 -1
  71. package/registry/auth-layout.json +1 -1
  72. package/registry/avatar.json +1 -1
  73. package/registry/badge.json +1 -1
  74. package/registry/bird-plate.json +1 -1
  75. package/registry/button.json +1 -1
  76. package/registry/captcha.json +1 -1
  77. package/registry/card-grid.json +1 -1
  78. package/registry/card.json +1 -1
  79. package/registry/catalogue-page.json +1 -1
  80. package/registry/changelog-page.json +1 -1
  81. package/registry/chapter.json +1 -1
  82. package/registry/chat.json +1 -1
  83. package/registry/checkbox.json +1 -1
  84. package/registry/chip-link.json +1 -1
  85. package/registry/chip-row.json +1 -1
  86. package/registry/chip.json +1 -1
  87. package/registry/choice-grid.json +1 -1
  88. package/registry/code-block.json +1 -1
  89. package/registry/collection-switcher.json +1 -1
  90. package/registry/combobox.json +1 -1
  91. package/registry/command.json +1 -1
  92. package/registry/comparison-table.json +1 -1
  93. package/registry/component-page.json +1 -1
  94. package/registry/confirm-button.json +1 -1
  95. package/registry/contact-page.json +1 -1
  96. package/registry/continue-prompt.json +1 -1
  97. package/registry/copy-button.json +382 -0
  98. package/registry/countdown.json +1 -1
  99. package/registry/cover-hero.json +1 -1
  100. package/registry/cta-panel.json +1 -1
  101. package/registry/dashboard-layout.json +1 -1
  102. package/registry/data-table.json +1 -1
  103. package/registry/date-picker.json +1 -1
  104. package/registry/decision-list.json +1 -1
  105. package/registry/description-list.json +1 -1
  106. package/registry/desktop-window.json +1 -1
  107. package/registry/detail-layout.json +1 -1
  108. package/registry/dialog.json +1 -1
  109. package/registry/docs-article-page.json +1 -1
  110. package/registry/docs-hub-page.json +1 -1
  111. package/registry/docs-layout.json +1 -1
  112. package/registry/docs-nav.json +1 -1
  113. package/registry/document-viewer.json +1 -1
  114. package/registry/doodle.json +1 -1
  115. package/registry/drop-overlay.json +1 -1
  116. package/registry/dropdown-menu.json +1 -1
  117. package/registry/elephant.json +2 -2
  118. package/registry/embed-facade.json +1 -1
  119. package/registry/empty-state.json +1 -1
  120. package/registry/engine-flow.json +1 -1
  121. package/registry/entity-header.json +1 -1
  122. package/registry/environment-notice.json +1 -1
  123. package/registry/error-page.json +1 -1
  124. package/registry/examples/copy-button/default.d.ts +4 -0
  125. package/registry/examples/copy-button/default.js +11 -0
  126. package/registry/examples/copy-button/default.tsx +7 -0
  127. package/registry/examples/copy-button/icon-only.d.ts +4 -0
  128. package/registry/examples/copy-button/icon-only.js +11 -0
  129. package/registry/examples/copy-button/icon-only.tsx +7 -0
  130. package/registry/examples/money-input/currencies.d.ts +4 -0
  131. package/registry/examples/money-input/currencies.js +18 -0
  132. package/registry/examples/money-input/currencies.tsx +16 -0
  133. package/registry/examples/money-input/default.d.ts +4 -0
  134. package/registry/examples/money-input/default.js +18 -0
  135. package/registry/examples/money-input/default.tsx +16 -0
  136. package/registry/examples/promo-code-field/applied.d.ts +4 -0
  137. package/registry/examples/promo-code-field/applied.js +11 -0
  138. package/registry/examples/promo-code-field/applied.tsx +7 -0
  139. package/registry/examples/promo-code-field/default.d.ts +4 -0
  140. package/registry/examples/promo-code-field/default.js +19 -0
  141. package/registry/examples/promo-code-field/default.tsx +14 -0
  142. package/registry/examples/promo-code-field/expired.d.ts +4 -0
  143. package/registry/examples/promo-code-field/expired.js +11 -0
  144. package/registry/examples/promo-code-field/expired.tsx +7 -0
  145. package/registry/examples/retro-tv/playlist-channel.d.ts +4 -0
  146. package/registry/examples/retro-tv/playlist-channel.js +15 -0
  147. package/registry/examples/retro-tv/playlist-channel.tsx +10 -0
  148. package/registry/examples/retro-tv/playlist-crossfade.d.ts +4 -0
  149. package/registry/examples/retro-tv/playlist-crossfade.js +15 -0
  150. package/registry/examples/retro-tv/playlist-crossfade.tsx +10 -0
  151. package/registry/examples/retro-tv/playlist-slide.d.ts +4 -0
  152. package/registry/examples/retro-tv/playlist-slide.js +15 -0
  153. package/registry/examples/retro-tv/playlist-slide.tsx +10 -0
  154. package/registry/examples/shop/booking-closing-closed.d.ts +4 -0
  155. package/registry/examples/shop/booking-closing-closed.js +26 -0
  156. package/registry/examples/shop/booking-closing-closed.tsx +22 -0
  157. package/registry/examples/shop/booking-closing-mark.d.ts +4 -0
  158. package/registry/examples/shop/booking-closing-mark.js +13 -0
  159. package/registry/examples/shop/booking-closing-mark.tsx +12 -0
  160. package/registry/examples/shop/booking-closing.d.ts +4 -0
  161. package/registry/examples/shop/booking-closing.js +27 -0
  162. package/registry/examples/shop/booking-closing.tsx +23 -0
  163. package/registry/examples/shop-gallery/five.d.ts +4 -0
  164. package/registry/examples/shop-gallery/five.js +14 -0
  165. package/registry/examples/shop-gallery/five.tsx +10 -0
  166. package/registry/examples/shop-gallery/three.d.ts +4 -0
  167. package/registry/examples/shop-gallery/three.js +14 -0
  168. package/registry/examples/shop-gallery/three.tsx +10 -0
  169. package/registry/examples/shop-gallery/twelve.d.ts +4 -0
  170. package/registry/examples/shop-gallery/twelve.js +14 -0
  171. package/registry/examples/shop-gallery/twelve.tsx +10 -0
  172. package/registry/field.json +1 -1
  173. package/registry/file-upload.json +1 -1
  174. package/registry/filter-bar.json +2 -2
  175. package/registry/flock.json +1 -1
  176. package/registry/footnote.json +1 -1
  177. package/registry/force-update-screen.json +1 -1
  178. package/registry/form.json +1 -1
  179. package/registry/gallery-page.json +1 -1
  180. package/registry/genui.json +1 -1
  181. package/registry/glossary-term.json +1 -1
  182. package/registry/glossary.json +1 -1
  183. package/registry/glow-card.json +1 -1
  184. package/registry/goal-gauge.json +1 -1
  185. package/registry/grade-stamp.json +1 -1
  186. package/registry/how-it-works-page.json +1 -1
  187. package/registry/image-cropper.json +1 -1
  188. package/registry/index.json +142 -10
  189. package/registry/iso.json +1 -1
  190. package/registry/kanban.json +1 -1
  191. package/registry/kbd.json +1 -1
  192. package/registry/kind-config-editor.json +1 -1
  193. package/registry/kpi-explained.json +1 -1
  194. package/registry/landing-page.json +1 -1
  195. package/registry/landscape.json +1 -1
  196. package/registry/language-switch.json +1 -1
  197. package/registry/legal-page.json +1 -1
  198. package/registry/link-card.json +1 -1
  199. package/registry/list.json +1 -1
  200. package/registry/loader.json +1 -1
  201. package/registry/longform-page.json +1 -1
  202. package/registry/maintenance-screen.json +1 -1
  203. package/registry/map.json +2 -2
  204. package/registry/margin-layout.json +1 -1
  205. package/registry/markdown.json +1 -1
  206. package/registry/marketing-layout.json +1 -1
  207. package/registry/marquee.json +1 -1
  208. package/registry/mascot-quote.json +1 -1
  209. package/registry/mascot-state.json +1 -1
  210. package/registry/mascots.json +1 -1
  211. package/registry/match-dialog.json +1 -1
  212. package/registry/media-capture.json +1 -1
  213. package/registry/media-gallery.json +1 -1
  214. package/registry/media-grid.json +1 -1
  215. package/registry/meta-row.json +1 -1
  216. package/registry/meter.json +1 -1
  217. package/registry/money-input.json +236 -0
  218. package/registry/nav-bar.json +22 -8
  219. package/registry/next-actions.json +1 -1
  220. package/registry/notification-preferences.json +1 -1
  221. package/registry/number-ticker.json +1 -1
  222. package/registry/opening-hours.json +1 -1
  223. package/registry/page-header.json +1 -1
  224. package/registry/page-hero.json +1 -1
  225. package/registry/page-index.json +1 -1
  226. package/registry/page.json +1 -1
  227. package/registry/pagination.json +1 -1
  228. package/registry/photo-grid.json +1 -1
  229. package/registry/pointer-light.json +1 -1
  230. package/registry/popover.json +1 -1
  231. package/registry/pricing-page.json +1 -1
  232. package/registry/product-page.json +1 -1
  233. package/registry/profile-card.json +1 -1
  234. package/registry/progress.json +1 -1
  235. package/registry/promise-card.json +1 -1
  236. package/registry/promo-code-field.json +258 -0
  237. package/registry/qr-code.json +1 -1
  238. package/registry/quota-meter.json +1 -1
  239. package/registry/radio-group.json +1 -1
  240. package/registry/rail-nav.json +2 -2
  241. package/registry/recipes.json +1 -1
  242. package/registry/retro-tv.json +120 -8
  243. package/registry/reviews.json +1 -1
  244. package/registry/router.json +1 -1
  245. package/registry/scroll-stage.json +1 -1
  246. package/registry/search-field.json +1 -1
  247. package/registry/section-backdrop.json +1 -1
  248. package/registry/separator.json +1 -1
  249. package/registry/service-card.json +1 -1
  250. package/registry/settings-layout.json +1 -1
  251. package/registry/shop-composer.json +1 -1
  252. package/registry/shop-gallery.json +209 -0
  253. package/registry/shop.json +30 -6
  254. package/registry/showcase.json +1 -1
  255. package/registry/signature.json +1 -1
  256. package/registry/site-cahier.json +1 -1
  257. package/registry/site-footer.json +2 -2
  258. package/registry/sites.json +1 -1
  259. package/registry/skeleton.json +1 -1
  260. package/registry/skip-link.json +1 -1
  261. package/registry/slider.json +1 -1
  262. package/registry/slot-picker.json +1 -1
  263. package/registry/slot.json +1 -1
  264. package/registry/specimen-tag.json +1 -1
  265. package/registry/speed-lines.json +1 -1
  266. package/registry/spinner.json +1 -1
  267. package/registry/split-view.json +1 -1
  268. package/registry/stage-banner.json +1 -1
  269. package/registry/stat.json +1 -1
  270. package/registry/status-chip.json +1 -1
  271. package/registry/status-page.json +1 -1
  272. package/registry/step-progress.json +1 -1
  273. package/registry/step-showcase.json +1 -1
  274. package/registry/stepper.json +1 -1
  275. package/registry/sticky-action.json +1 -1
  276. package/registry/stuck.json +1 -1
  277. package/registry/swipe-deck.json +1 -1
  278. package/registry/switch.json +1 -1
  279. package/registry/tabs.json +1 -1
  280. package/registry/tag-input.json +1 -1
  281. package/registry/tag-selector.json +2 -2
  282. package/registry/taped-photo.json +1 -1
  283. package/registry/terminal-replay.json +1 -1
  284. package/registry/text-style.json +1 -1
  285. package/registry/theme.json +1 -1
  286. package/registry/toast.json +1 -1
  287. package/registry/toc.json +1 -1
  288. package/registry/tooltip.json +1 -1
  289. package/registry/tree-view.json +1 -1
  290. package/registry/update-prompt.json +1 -1
  291. package/registry/upload-queue.json +1 -1
  292. package/registry/usage.json +1 -1
  293. package/registry/verified-badge.json +1 -1
  294. package/registry/versus-card.json +1 -1
  295. package/registry/vertical-video.json +1 -1
  296. package/registry/video-player.json +1 -1
  297. package/registry/video-trimmer.json +1 -1
  298. package/registry/virtual.json +1 -1
  299. package/registry/wall.json +1 -1
  300. package/registry/waveform.json +1 -1
  301. /package/dist/{chunk-E4X3V7QX.js.map → chunk-GRVIZTT2.js.map} +0 -0
@@ -1,5 +1,8 @@
1
1
  "use client";
2
2
  import "./chunk-NPF3OHE2.js";
3
+ import {
4
+ Dialog
5
+ } from "./chunk-E4FMPPDL.js";
3
6
  import {
4
7
  Avatar
5
8
  } from "./chunk-HK525THY.js";
@@ -8,153 +11,27 @@ import {
8
11
  } from "./chunk-BDIU5LZB.js";
9
12
  import "./chunk-JXLDUDTD.js";
10
13
  import {
11
- Button,
12
- IconButton
14
+ Button
13
15
  } from "./chunk-M3GEYLMR.js";
14
16
  import "./chunk-D3T54RSL.js";
15
17
  import "./chunk-NSLXEDIS.js";
16
18
 
17
- // src/dialog/dialog.tsx
18
- import { Dialog as DialogPrimitive } from "radix-ui";
19
- import { tv } from "tailwind-variants";
20
-
21
- // src/dialog/return-focus.ts
22
- import * as React from "react";
23
- function useReturnFocus(onCloseAutoFocus) {
24
- const [opener] = React.useState(() => typeof document === "undefined" ? null : document.activeElement);
25
- return React.useCallback(
26
- (event) => {
27
- onCloseAutoFocus?.(event);
28
- if (event.defaultPrevented) return;
29
- if (opener instanceof HTMLElement && opener !== document.body && opener.isConnected) {
30
- event.preventDefault();
31
- opener.focus();
32
- }
33
- },
34
- [opener, onCloseAutoFocus]
35
- );
36
- }
37
-
38
- // src/dialog/dialog.tsx
39
- import { jsx, jsxs } from "react/jsx-runtime";
40
- var dialog = tv({
41
- slots: {
42
- overlay: "kz-overlay fixed inset-0 z-50 bg-overlay",
43
- content: "kz-dialog fixed z-50 flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg shadow-lg focus:outline-hidden",
44
- close: "absolute right-3 top-3 h-9 w-9",
45
- header: "flex flex-col gap-1 px-5 pb-2 pr-14 pt-5",
46
- title: "text-base font-bold text-fg",
47
- description: "text-sm text-fg-secondary",
48
- body: "min-h-0 flex-1 overflow-y-auto px-5 pb-5",
49
- footer: "flex flex-wrap items-center justify-end gap-2 border-t border-border-subtle px-5 py-4 pb-[max(1rem,env(safe-area-inset-bottom))]"
50
- },
51
- variants: {
52
- placement: {
53
- center: { content: "left-1/2 top-1/2 max-h-[85dvh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl" },
54
- /* A sheet: anchored at the bottom on a phone, centred from `sm` up. */
55
- bottom: {
56
- content: "inset-x-0 bottom-0 max-h-[92dvh] rounded-t-[1.75rem] sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-[1.75rem]"
57
- },
58
- right: { content: "inset-y-0 right-0 h-full w-full max-w-md rounded-none border-y-0 border-r-0" },
59
- /* A navigation drawer: full height, from the left, clear of the notch. */
60
- left: { content: "inset-y-0 left-0 h-full w-full max-w-md rounded-none border-y-0 border-l-0 pl-[env(safe-area-inset-left)]" }
61
- },
62
- size: { sm: { content: "sm:max-w-sm" }, md: { content: "sm:max-w-md" }, lg: { content: "sm:max-w-2xl" } }
63
- },
64
- defaultVariants: { placement: "center", size: "md" }
65
- });
66
- var s = dialog();
67
- function CloseIcon() {
68
- return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
69
- }
70
- var prevent = (event) => event.preventDefault();
71
- function ReturnFocusContent({ onCloseAutoFocus, ...props }) {
72
- return /* @__PURE__ */ jsx(DialogPrimitive.Content, { onCloseAutoFocus: useReturnFocus(onCloseAutoFocus), ...props });
73
- }
74
- function DialogContent({
75
- placement,
76
- size,
77
- closeLabel,
78
- hideClose,
79
- dismissible = true,
80
- container,
81
- className,
82
- children,
83
- onEscapeKeyDown,
84
- onPointerDownOutside,
85
- onInteractOutside,
86
- ...props
87
- }) {
88
- const v = dialog({ placement, size });
89
- return /* @__PURE__ */ jsxs(DialogPrimitive.Portal, { container, children: [
90
- /* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: v.overlay() }),
91
- /* @__PURE__ */ jsxs(
92
- ReturnFocusContent,
93
- {
94
- "data-placement": placement ?? "center",
95
- "data-dismissible": dismissible ? void 0 : "false",
96
- className: v.content({ className }),
97
- onEscapeKeyDown: dismissible ? onEscapeKeyDown : chain(onEscapeKeyDown, prevent),
98
- onPointerDownOutside: dismissible ? onPointerDownOutside : chain(onPointerDownOutside, prevent),
99
- onInteractOutside: dismissible ? onInteractOutside : chain(onInteractOutside, prevent),
100
- ...props,
101
- children: [
102
- children,
103
- !hideClose && /* @__PURE__ */ jsx(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { label: closeLabel, variant: "ghost", shape: "pill", className: v.close(), children: /* @__PURE__ */ jsx(CloseIcon, {}) }) })
104
- ]
105
- }
106
- )
107
- ] });
108
- }
109
- function chain(handler, then) {
110
- return (event) => {
111
- handler?.(event);
112
- then(event);
113
- };
114
- }
115
- function DialogHeader({ className, ...props }) {
116
- return /* @__PURE__ */ jsx("div", { className: s.header({ className }), ...props });
117
- }
118
- function DialogTitle({ className, ...props }) {
119
- return /* @__PURE__ */ jsx(DialogPrimitive.Title, { className: s.title({ className }), ...props });
120
- }
121
- function DialogDescription({ className, ...props }) {
122
- return /* @__PURE__ */ jsx(DialogPrimitive.Description, { className: s.description({ className }), ...props });
123
- }
124
- function DialogBody({ className, ...props }) {
125
- return /* @__PURE__ */ jsx("div", { className: s.body({ className }), ...props });
126
- }
127
- function DialogFooter({ className, ...props }) {
128
- return /* @__PURE__ */ jsx("div", { className: s.footer({ className }), ...props });
129
- }
130
- var Dialog = {
131
- Root: DialogPrimitive.Root,
132
- Trigger: DialogPrimitive.Trigger,
133
- Close: DialogPrimitive.Close,
134
- Content: DialogContent,
135
- Header: DialogHeader,
136
- Title: DialogTitle,
137
- Description: DialogDescription,
138
- Body: DialogBody,
139
- Footer: DialogFooter
140
- };
141
-
142
19
  // src/match-dialog/match-dialog.tsx
143
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
20
+ import { jsx, jsxs } from "react/jsx-runtime";
144
21
  function MatchDialog({ open, onOpenChange, title, description, people, primaryLabel, onPrimary, secondaryLabel, container }) {
145
22
  warnDeprecated("match-dialog");
146
- return /* @__PURE__ */ jsx2(Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(Dialog.Content, { hideClose: true, size: "sm", container, className: "overflow-hidden border-0 bg-gradient-to-br from-accent to-accent-2 text-center text-on-accent", children: [
147
- /* @__PURE__ */ jsx2("style", { href: "krizaka-match", precedence: "default", children: "@media (prefers-reduced-motion:no-preference){[data-kz-match] [data-side=a]{animation:kz-match-a .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-side=b]{animation:kz-match-b .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-heart]{animation:kz-match-heart .45s .25s cubic-bezier(.3,1.6,.5,1) both}}@keyframes kz-match-a{from{transform:translateX(-60px) rotate(-8deg);opacity:0}}@keyframes kz-match-b{from{transform:translateX(60px) rotate(8deg);opacity:0}}@keyframes kz-match-heart{from{transform:scale(0)}}" }),
148
- /* @__PURE__ */ jsxs2("div", { "data-kz-match": "", className: "flex flex-col items-center gap-3 px-2 pb-2 pt-6", children: [
149
- /* @__PURE__ */ jsx2(Dialog.Title, { className: "font-display text-4xl font-black text-on-accent", children: title }),
150
- description ? /* @__PURE__ */ jsx2(Dialog.Description, { className: "max-w-xs text-sm text-on-accent", children: description }) : null,
151
- /* @__PURE__ */ jsxs2("div", { className: "relative my-6 flex h-36 w-64 items-center justify-center", "aria-hidden": true, children: [
152
- /* @__PURE__ */ jsx2("span", { "data-side": "a", className: "absolute left-6 -rotate-6 rounded-full ring-4 ring-on-accent", children: /* @__PURE__ */ jsx2(Avatar, { src: people[0].src ?? null, alt: "", fallback: people[0].name.charAt(0), className: "h-28 w-28 text-3xl" }) }),
153
- /* @__PURE__ */ jsx2("span", { "data-side": "b", className: "absolute right-6 rotate-6 rounded-full ring-4 ring-on-accent", children: /* @__PURE__ */ jsx2(Avatar, { src: people[1].src ?? null, alt: "", fallback: people[1].name.charAt(0), className: "h-28 w-28 text-3xl" }) }),
154
- /* @__PURE__ */ jsx2("span", { "data-heart": "", className: "absolute -bottom-1 flex h-12 w-12 items-center justify-center rounded-full bg-on-accent text-accent shadow-lg", children: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", className: "h-6 w-6", fill: "currentColor", children: /* @__PURE__ */ jsx2("path", { d: "M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z" }) }) })
23
+ return /* @__PURE__ */ jsx(Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(Dialog.Content, { hideClose: true, size: "sm", container, className: "overflow-hidden border-0 bg-gradient-to-br from-accent to-accent-2 text-center text-on-accent", children: [
24
+ /* @__PURE__ */ jsx("style", { href: "krizaka-match", precedence: "default", children: "@media (prefers-reduced-motion:no-preference){[data-kz-match] [data-side=a]{animation:kz-match-a .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-side=b]{animation:kz-match-b .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-heart]{animation:kz-match-heart .45s .25s cubic-bezier(.3,1.6,.5,1) both}}@keyframes kz-match-a{from{transform:translateX(-60px) rotate(-8deg);opacity:0}}@keyframes kz-match-b{from{transform:translateX(60px) rotate(8deg);opacity:0}}@keyframes kz-match-heart{from{transform:scale(0)}}" }),
25
+ /* @__PURE__ */ jsxs("div", { "data-kz-match": "", className: "flex flex-col items-center gap-3 px-2 pb-2 pt-6", children: [
26
+ /* @__PURE__ */ jsx(Dialog.Title, { className: "font-display text-4xl font-black text-on-accent", children: title }),
27
+ description ? /* @__PURE__ */ jsx(Dialog.Description, { className: "max-w-xs text-sm text-on-accent", children: description }) : null,
28
+ /* @__PURE__ */ jsxs("div", { className: "relative my-6 flex h-36 w-64 items-center justify-center", "aria-hidden": true, children: [
29
+ /* @__PURE__ */ jsx("span", { "data-side": "a", className: "absolute left-6 -rotate-6 rounded-full ring-4 ring-on-accent", children: /* @__PURE__ */ jsx(Avatar, { src: people[0].src ?? null, alt: "", fallback: people[0].name.charAt(0), className: "h-28 w-28 text-3xl" }) }),
30
+ /* @__PURE__ */ jsx("span", { "data-side": "b", className: "absolute right-6 rotate-6 rounded-full ring-4 ring-on-accent", children: /* @__PURE__ */ jsx(Avatar, { src: people[1].src ?? null, alt: "", fallback: people[1].name.charAt(0), className: "h-28 w-28 text-3xl" }) }),
31
+ /* @__PURE__ */ jsx("span", { "data-heart": "", className: "absolute -bottom-1 flex h-12 w-12 items-center justify-center rounded-full bg-on-accent text-accent shadow-lg", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "h-6 w-6", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z" }) }) })
155
32
  ] }),
156
- /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col gap-2", children: [
157
- /* @__PURE__ */ jsx2(
33
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
34
+ /* @__PURE__ */ jsx(
158
35
  Button,
159
36
  {
160
37
  size: "lg",
@@ -165,7 +42,7 @@ function MatchDialog({ open, onOpenChange, title, description, people, primaryLa
165
42
  children: primaryLabel
166
43
  }
167
44
  ),
168
- /* @__PURE__ */ jsx2(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx2(Button, { size: "lg", variant: "ghost", className: "text-on-accent hover:bg-on-accent/15", children: secondaryLabel }) })
45
+ /* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "lg", variant: "ghost", className: "text-on-accent hover:bg-on-accent/15", children: secondaryLabel }) })
169
46
  ] })
170
47
  ] })
171
48
  ] }) });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dialog/dialog.tsx","../src/dialog/return-focus.ts","../src/match-dialog/match-dialog.tsx"],"sourcesContent":["// Client (a portal). Radix does the focus trap, the scroll lock, Escape, the outside click, aria-modal, the\n// aria-labelledby / aria-describedby wiring and the focus return: this file only holds the shape.\nimport { Dialog as DialogPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nimport { IconButton } from \"../button/button\";\nimport { useReturnFocus } from \"./return-focus\";\n\nexport const dialog = tv({\n slots: {\n overlay: \"kz-overlay fixed inset-0 z-50 bg-overlay\",\n content:\n \"kz-dialog fixed z-50 flex flex-col overflow-hidden border border-border-default bg-surface-1 text-fg shadow-lg focus:outline-hidden\",\n close: \"absolute right-3 top-3 h-9 w-9\",\n header: \"flex flex-col gap-1 px-5 pb-2 pr-14 pt-5\",\n title: \"text-base font-bold text-fg\",\n description: \"text-sm text-fg-secondary\",\n body: \"min-h-0 flex-1 overflow-y-auto px-5 pb-5\",\n footer:\n \"flex flex-wrap items-center justify-end gap-2 border-t border-border-subtle px-5 py-4 pb-[max(1rem,env(safe-area-inset-bottom))]\",\n },\n variants: {\n placement: {\n center: { content: \"left-1/2 top-1/2 max-h-[85dvh] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl\" },\n /* A sheet: anchored at the bottom on a phone, centred from `sm` up. */\n bottom: {\n content:\n \"inset-x-0 bottom-0 max-h-[92dvh] rounded-t-[1.75rem] sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:w-full \" +\n \"sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-[1.75rem]\",\n },\n right: { content: \"inset-y-0 right-0 h-full w-full max-w-md rounded-none border-y-0 border-r-0\" },\n /* A navigation drawer: full height, from the left, clear of the notch. */\n left: { content: \"inset-y-0 left-0 h-full w-full max-w-md rounded-none border-y-0 border-l-0 pl-[env(safe-area-inset-left)]\" },\n },\n size: { sm: { content: \"sm:max-w-sm\" }, md: { content: \"sm:max-w-md\" }, lg: { content: \"sm:max-w-2xl\" } },\n },\n defaultVariants: { placement: \"center\", size: \"md\" },\n});\nconst s = dialog();\n\nexport type DialogVariants = VariantProps<typeof dialog>;\n\nfunction CloseIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-4 w-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\ntype CloseButtonProps =\n | {\n /** The accessible name of the close button — passed translated. */\n closeLabel: string;\n /** Leaves the close button out (the content brings its own way out, or none: see `dismissible`). */\n hideClose?: false;\n }\n | { closeLabel?: string; hideClose: true };\n\nexport type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> &\n DialogVariants &\n CloseButtonProps & {\n /**\n * center · bottom (a sheet on a phone, centred from `sm` up) · right (a side panel, full height) · left (a\n * navigation drawer, full height).\n * @default \"center\"\n */\n placement?: DialogVariants[\"placement\"];\n /**\n * sm · md · lg: the width of the dialog.\n * @default \"md\"\n */\n size?: DialogVariants[\"size\"];\n /**\n * `false`: Escape and a click outside do not close it (a gate the user must answer: age, terms). It still closes\n * through `open` / `onOpenChange` and any `Dialog.Close` inside. Default `true`.\n */\n dismissible?: boolean;\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n };\n\nconst prevent = (event: Event) => event.preventDefault();\n\n/** Radix's content, mounted only while open: it remembers the opener then and gives focus back on close (WCAG 2.4.3). */\nfunction ReturnFocusContent({ onCloseAutoFocus, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>) {\n return <DialogPrimitive.Content onCloseAutoFocus={useReturnFocus(onCloseAutoFocus)} {...props} />;\n}\n\n/** The dialog itself, portalled over a dimmed overlay, with a close button. Give it a `Dialog.Title`. */\nexport function DialogContent({\n placement,\n size,\n closeLabel,\n hideClose,\n dismissible = true,\n container,\n className,\n children,\n onEscapeKeyDown,\n onPointerDownOutside,\n onInteractOutside,\n ...props\n}: DialogContentProps) {\n const v = dialog({ placement, size });\n return (\n <DialogPrimitive.Portal container={container}>\n <DialogPrimitive.Overlay className={v.overlay()} />\n <ReturnFocusContent\n data-placement={placement ?? \"center\"}\n data-dismissible={dismissible ? undefined : \"false\"}\n className={v.content({ className })}\n onEscapeKeyDown={dismissible ? onEscapeKeyDown : chain(onEscapeKeyDown, prevent)}\n onPointerDownOutside={dismissible ? onPointerDownOutside : chain(onPointerDownOutside, prevent)}\n onInteractOutside={dismissible ? onInteractOutside : chain(onInteractOutside, prevent)}\n {...props}\n >\n {children}\n {!hideClose && (\n <DialogPrimitive.Close asChild>\n <IconButton label={closeLabel as string} variant=\"ghost\" shape=\"pill\" className={v.close()}>\n <CloseIcon />\n </IconButton>\n </DialogPrimitive.Close>\n )}\n </ReturnFocusContent>\n </DialogPrimitive.Portal>\n );\n}\n\nfunction chain<E extends Event>(handler: ((event: E) => void) | undefined, then: (event: E) => void) {\n return (event: E) => {\n handler?.(event);\n then(event);\n };\n}\n\nexport function DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.header({ className })} {...props} />;\n}\n\nexport function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return <DialogPrimitive.Title className={s.title({ className })} {...props} />;\n}\n\nexport function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return <DialogPrimitive.Description className={s.description({ className })} {...props} />;\n}\n\nexport function DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.body({ className })} {...props} />;\n}\n\nexport function DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return <div className={s.footer({ className })} {...props} />;\n}\n\n/** `Dialog.Root/Trigger/Content/Header/Title/Description/Body/Footer/Close`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const Dialog = {\n Root: DialogPrimitive.Root,\n Trigger: DialogPrimitive.Trigger,\n Close: DialogPrimitive.Close,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n};\n\n/** `Omit` that keeps the close-button union (`closeLabel` required unless `hideClose`). */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;\n\nexport type SheetProps = DistributiveOmit<DialogContentProps, \"placement\">;\n\n/** A sheet is a dialog anchored at the bottom (centred from `sm` up): `Dialog.Content placement=\"bottom\"`. */\nexport function Sheet(props: SheetProps) {\n return <DialogContent placement=\"bottom\" {...props} />;\n}\n","// Client. WCAG 2.4.3: when a dialog closes, focus goes back to what opened it. Radix only does it for `Dialog.Trigger`;\n// most app dialogs are controlled (`open` / `onOpenChange`) and opened by a plain button, so on Escape focus fell to\n// <body>. The content remembers the focused element when it mounts (it is still the opener: Radix moves focus in an\n// effect) and gives it back on close, unless the consumer's `onCloseAutoFocus` prevented the default.\nimport * as React from \"react\";\n\n/** The handler for `onCloseAutoFocus`: yours first, then focus back on the opener if it is still on the page. */\nexport function useReturnFocus(onCloseAutoFocus?: (event: Event) => void) {\n const [opener] = React.useState<Element | null>(() => (typeof document === \"undefined\" ? null : document.activeElement));\n return React.useCallback(\n (event: Event) => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n if (opener instanceof HTMLElement && opener !== document.body && opener.isConnected) {\n event.preventDefault();\n opener.focus();\n }\n },\n [opener, onCloseAutoFocus],\n );\n}\n","// Client (a portal). The moment two people choose each other — a match, a pair, a deal: a dialog in the brand\n// gradient, the two avatars meeting at a heart, the next step. The entrance plays once; still under reduced motion.\nimport * as React from \"react\";\n\nimport { Avatar } from \"../avatar\";\nimport { Button } from \"../button\";\nimport { warnDeprecated } from \"../deprecated\";\nimport { Dialog } from \"../dialog\";\n\nexport type MatchDialogProps = {\n /** Shown (controlled). */\n open: boolean;\n /** Called when it closes. */\n onOpenChange: (open: boolean) => void;\n /** The headline (“It's a match!”) — passed translated; the dialog's name. */\n title: string;\n /** A line under it. */\n description?: string;\n /** The two people: avatar URLs and names. */\n people: readonly [{ src?: string | null; name: string }, { src?: string | null; name: string }];\n /** The main action (“Send a message”). */\n primaryLabel: string;\n /** What it does. */\n onPrimary: () => void;\n /** The way back (“Keep swiping”). */\n secondaryLabel: string;\n /** Where it is drawn (the page's body by default): give an element inside a brand scope (`.brand-…`) so the dialog wears the brand too. */\n container?: HTMLElement | null;\n};\n\n/**\n * Two people choose each other: the avatars meet at a heart in the brand gradient, the next step under them.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function MatchDialog({ open, onOpenChange, title, description, people, primaryLabel, onPrimary, secondaryLabel, container }: MatchDialogProps) {\n warnDeprecated(\"match-dialog\");\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Content hideClose size=\"sm\" container={container} className=\"overflow-hidden border-0 bg-gradient-to-br from-accent to-accent-2 text-center text-on-accent\">\n <style href=\"krizaka-match\" precedence=\"default\">\n {\"@media (prefers-reduced-motion:no-preference){[data-kz-match] [data-side=a]{animation:kz-match-a .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-side=b]{animation:kz-match-b .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-heart]{animation:kz-match-heart .45s .25s cubic-bezier(.3,1.6,.5,1) both}}@keyframes kz-match-a{from{transform:translateX(-60px) rotate(-8deg);opacity:0}}@keyframes kz-match-b{from{transform:translateX(60px) rotate(8deg);opacity:0}}@keyframes kz-match-heart{from{transform:scale(0)}}\"}\n </style>\n <div data-kz-match=\"\" className=\"flex flex-col items-center gap-3 px-2 pb-2 pt-6\">\n <Dialog.Title className=\"font-display text-4xl font-black text-on-accent\">{title}</Dialog.Title>\n {description ? <Dialog.Description className=\"max-w-xs text-sm text-on-accent\">{description}</Dialog.Description> : null}\n <div className=\"relative my-6 flex h-36 w-64 items-center justify-center\" aria-hidden>\n <span data-side=\"a\" className=\"absolute left-6 -rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[0].src ?? null} alt=\"\" fallback={people[0].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-side=\"b\" className=\"absolute right-6 rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[1].src ?? null} alt=\"\" fallback={people[1].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-heart=\"\" className=\"absolute -bottom-1 flex h-12 w-12 items-center justify-center rounded-full bg-on-accent text-accent shadow-lg\">\n <svg viewBox=\"0 0 24 24\" className=\"h-6 w-6\" fill=\"currentColor\">\n <path d=\"M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z\" />\n </svg>\n </span>\n </div>\n <div className=\"flex w-full flex-col gap-2\">\n <Button\n size=\"lg\"\n onClick={() => {\n onOpenChange(false);\n onPrimary();\n }}\n >\n {primaryLabel}\n </Button>\n <Dialog.Close asChild>\n <Button size=\"lg\" variant=\"ghost\" className=\"text-on-accent hover:bg-on-accent/15\">\n {secondaryLabel}\n </Button>\n </Dialog.Close>\n </div>\n </div>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA,SAAS,UAAU,uBAAuB;AAE1C,SAAS,UAA6B;;;ACAtC,YAAY,WAAW;AAGhB,SAAS,eAAe,kBAA2C;AACxE,QAAM,CAAC,MAAM,IAAU,eAAyB,MAAO,OAAO,aAAa,cAAc,OAAO,SAAS,aAAc;AACvH,SAAa;AAAA,IACX,CAAC,UAAiB;AAChB,yBAAmB,KAAK;AACxB,UAAI,MAAM,iBAAkB;AAC5B,UAAI,kBAAkB,eAAe,WAAW,SAAS,QAAQ,OAAO,aAAa;AACnF,cAAM,eAAe;AACrB,eAAO,MAAM;AAAA,MACf;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,gBAAgB;AAAA,EAC3B;AACF;;;AD0BM,cA+DA,YA/DA;AArCC,IAAM,SAAS,GAAG;AAAA,EACvB,OAAO;AAAA,IACL,SAAS;AAAA,IACT,SACE;AAAA,IACF,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QACE;AAAA,EACJ;AAAA,EACA,UAAU;AAAA,IACR,WAAW;AAAA,MACT,QAAQ,EAAE,SAAS,kGAAkG;AAAA;AAAA,MAErH,QAAQ;AAAA,QACN,SACE;AAAA,MAEJ;AAAA,MACA,OAAO,EAAE,SAAS,8EAA8E;AAAA;AAAA,MAEhG,MAAM,EAAE,SAAS,4GAA4G;AAAA,IAC/H;AAAA,IACA,MAAM,EAAE,IAAI,EAAE,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AAK;AAAA,YACL,SAAS,MAAM;AACb,2BAAa,KAAK;AAClB,wBAAU;AAAA,YACZ;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA,gBAAAA,KAAC,OAAO,OAAP,EAAa,SAAO,MACnB,0BAAAA,KAAC,UAAO,MAAK,MAAK,SAAQ,SAAQ,WAAU,wCACzC,0BACH,GACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":["jsx","jsxs"]}
1
+ {"version":3,"sources":["../src/match-dialog/match-dialog.tsx"],"sourcesContent":["// Client (a portal). The moment two people choose each other — a match, a pair, a deal: a dialog in the brand\n// gradient, the two avatars meeting at a heart, the next step. The entrance plays once; still under reduced motion.\nimport * as React from \"react\";\n\nimport { Avatar } from \"../avatar\";\nimport { Button } from \"../button\";\nimport { warnDeprecated } from \"../deprecated\";\nimport { Dialog } from \"../dialog\";\n\nexport type MatchDialogProps = {\n /** Shown (controlled). */\n open: boolean;\n /** Called when it closes. */\n onOpenChange: (open: boolean) => void;\n /** The headline (“It's a match!”) — passed translated; the dialog's name. */\n title: string;\n /** A line under it. */\n description?: string;\n /** The two people: avatar URLs and names. */\n people: readonly [{ src?: string | null; name: string }, { src?: string | null; name: string }];\n /** The main action (“Send a message”). */\n primaryLabel: string;\n /** What it does. */\n onPrimary: () => void;\n /** The way back (“Keep swiping”). */\n secondaryLabel: string;\n /** Where it is drawn (the page's body by default): give an element inside a brand scope (`.brand-…`) so the dialog wears the brand too. */\n container?: HTMLElement | null;\n};\n\n/**\n * Two people choose each other: the avatars meet at a heart in the brand gradient, the next step under them.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function MatchDialog({ open, onOpenChange, title, description, people, primaryLabel, onPrimary, secondaryLabel, container }: MatchDialogProps) {\n warnDeprecated(\"match-dialog\");\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Content hideClose size=\"sm\" container={container} className=\"overflow-hidden border-0 bg-gradient-to-br from-accent to-accent-2 text-center text-on-accent\">\n <style href=\"krizaka-match\" precedence=\"default\">\n {\"@media (prefers-reduced-motion:no-preference){[data-kz-match] [data-side=a]{animation:kz-match-a .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-side=b]{animation:kz-match-b .55s cubic-bezier(.3,1.6,.5,1) both}[data-kz-match] [data-heart]{animation:kz-match-heart .45s .25s cubic-bezier(.3,1.6,.5,1) both}}@keyframes kz-match-a{from{transform:translateX(-60px) rotate(-8deg);opacity:0}}@keyframes kz-match-b{from{transform:translateX(60px) rotate(8deg);opacity:0}}@keyframes kz-match-heart{from{transform:scale(0)}}\"}\n </style>\n <div data-kz-match=\"\" className=\"flex flex-col items-center gap-3 px-2 pb-2 pt-6\">\n <Dialog.Title className=\"font-display text-4xl font-black text-on-accent\">{title}</Dialog.Title>\n {description ? <Dialog.Description className=\"max-w-xs text-sm text-on-accent\">{description}</Dialog.Description> : null}\n <div className=\"relative my-6 flex h-36 w-64 items-center justify-center\" aria-hidden>\n <span data-side=\"a\" className=\"absolute left-6 -rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[0].src ?? null} alt=\"\" fallback={people[0].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-side=\"b\" className=\"absolute right-6 rotate-6 rounded-full ring-4 ring-on-accent\">\n <Avatar src={people[1].src ?? null} alt=\"\" fallback={people[1].name.charAt(0)} className=\"h-28 w-28 text-3xl\" />\n </span>\n <span data-heart=\"\" className=\"absolute -bottom-1 flex h-12 w-12 items-center justify-center rounded-full bg-on-accent text-accent shadow-lg\">\n <svg viewBox=\"0 0 24 24\" className=\"h-6 w-6\" fill=\"currentColor\">\n <path d=\"M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z\" />\n </svg>\n </span>\n </div>\n <div className=\"flex w-full flex-col gap-2\">\n <Button\n size=\"lg\"\n onClick={() => {\n onOpenChange(false);\n onPrimary();\n }}\n >\n {primaryLabel}\n </Button>\n <Dialog.Close asChild>\n <Button size=\"lg\" variant=\"ghost\" className=\"text-on-accent hover:bg-on-accent/15\">\n {secondaryLabel}\n </Button>\n </Dialog.Close>\n </div>\n </div>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCQ,cAME,YANF;AALD,SAAS,YAAY,EAAE,MAAM,cAAc,OAAO,aAAa,QAAQ,cAAc,WAAW,gBAAgB,UAAU,GAAqB;AACpJ,iBAAe,cAAc;AAC7B,SACE,oBAAC,OAAO,MAAP,EAAY,MAAY,cACvB,+BAAC,OAAO,SAAP,EAAe,WAAS,MAAC,MAAK,MAAK,WAAsB,WAAU,iGAClE;AAAA,wBAAC,WAAM,MAAK,iBAAgB,YAAW,WACpC,2hBACH;AAAA,IACA,qBAAC,SAAI,iBAAc,IAAG,WAAU,mDAC9B;AAAA,0BAAC,OAAO,OAAP,EAAa,WAAU,mDAAmD,iBAAM;AAAA,MAChF,cAAc,oBAAC,OAAO,aAAP,EAAmB,WAAU,mCAAmC,uBAAY,IAAwB;AAAA,MACpH,qBAAC,SAAI,WAAU,4DAA2D,eAAW,MACnF;AAAA,4BAAC,UAAK,aAAU,KAAI,WAAU,gEAC5B,8BAAC,UAAO,KAAK,OAAO,CAAC,EAAE,OAAO,MAAM,KAAI,IAAG,UAAU,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,GAAG,WAAU,sBAAqB,GAChH;AAAA,QACA,oBAAC,UAAK,aAAU,KAAI,WAAU,gEAC5B,8BAAC,UAAO,KAAK,OAAO,CAAC,EAAE,OAAO,MAAM,KAAI,IAAG,UAAU,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,GAAG,WAAU,sBAAqB,GAChH;AAAA,QACA,oBAAC,UAAK,cAAW,IAAG,WAAU,iHAC5B,8BAAC,SAAI,SAAQ,aAAY,WAAU,WAAU,MAAK,gBAChD,8BAAC,UAAK,GAAE,uEAAsE,GAChF,GACF;AAAA,SACF;AAAA,MACA,qBAAC,SAAI,WAAU,8BACb;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS,MAAM;AACb,2BAAa,KAAK;AAClB,wBAAU;AAAA,YACZ;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA,oBAAC,OAAO,OAAP,EAAa,SAAO,MACnB,8BAAC,UAAO,MAAK,MAAK,SAAQ,SAAQ,WAAU,wCACzC,0BACH,GACF;AAAA,SACF;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ type MoneyInputProps = Omit<React.ComponentProps<"input">, "value" | "defaultValue" | "onChange" | "type" | "inputMode"> & {
4
+ /** The amount in minor units (cents), an integer, or `null` when empty. */
5
+ value: number | null;
6
+ /** Called with the new amount in minor units, or `null` when the field is emptied. */
7
+ onValueChange: (minorUnits: number | null) => void;
8
+ /** ISO 4217 code: `"CAD"`. */
9
+ currency: string;
10
+ /** BCP 47 locale for the separators: `"fr-CA"`, `"en-CA"`. */
11
+ locale: string;
12
+ /** The currencies to choose among (ISO codes). Omitted: the currency is fixed. */
13
+ currencies?: readonly string[];
14
+ /** Called with the chosen currency (required with `currencies`). */
15
+ onCurrencyChange?: (currency: string) => void;
16
+ /** The currency select's accessible name, passed translated: "Currency". */
17
+ currencyLabel?: string;
18
+ /** Marks the amount invalid (pair it with a `Field.Error`). */
19
+ invalid?: boolean;
20
+ };
21
+ /** "12,50" → 1250 without a float; `undefined` when the text is not an amount or has too many decimals. */
22
+ declare function parseMinorUnits(text: string, locale: string, digits: number): number | null | undefined;
23
+ /** Minor units → "1 234,50" in the locale, exact (BigInt), padded to the currency's decimals. */
24
+ declare function formatMinorUnits(minor: number, locale: string, digits: number): string;
25
+ /** An amount field in minor units. The caller holds an integer; the person sees their locale's decimal. */
26
+ declare function MoneyInput({ value, onValueChange, currency, locale, currencies, onCurrencyChange, currencyLabel, invalid, className, onBlur, disabled, ...props }: MoneyInputProps): React.JSX.Element;
27
+
28
+ export { MoneyInput, formatMinorUnits, parseMinorUnits };
29
+ export type { MoneyInputProps };
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import {
3
+ Input,
4
+ Select
5
+ } from "./chunk-PZ4FJOD5.js";
6
+ import {
7
+ cn
8
+ } from "./chunk-NSLXEDIS.js";
9
+
10
+ // src/money-input/money-input.tsx
11
+ import { currencyDigits } from "@krizaka/intl";
12
+ import * as React from "react";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var separators = (locale) => {
15
+ const parts = new Intl.NumberFormat(locale, { useGrouping: true, minimumFractionDigits: 1 }).formatToParts(12345671e-1);
16
+ return { decimal: parts.find((p) => p.type === "decimal")?.value ?? ".", group: parts.find((p) => p.type === "group")?.value ?? "," };
17
+ };
18
+ function parseMinorUnits(text, locale, digits) {
19
+ const { decimal } = separators(locale);
20
+ const cleaned = text.replace(/\s/g, "");
21
+ if (cleaned === "") return null;
22
+ const marks = [...cleaned].filter((c) => c === "." || c === "," || c === decimal);
23
+ if (!/^[\d.,]+$/.test(cleaned.replaceAll(decimal, ""))) return void 0;
24
+ const last = marks.length ? Math.max(cleaned.lastIndexOf("."), cleaned.lastIndexOf(","), cleaned.lastIndexOf(decimal)) : -1;
25
+ const whole = (last >= 0 ? cleaned.slice(0, last) : cleaned).replace(/\D/g, "");
26
+ const fraction = last >= 0 ? cleaned.slice(last + 1) : "";
27
+ if (!/^\d*$/.test(fraction) || fraction.length > digits || digits === 0 && last >= 0) return void 0;
28
+ const minor = Number(`${whole || "0"}${fraction.padEnd(digits, "0")}`);
29
+ return Number.isSafeInteger(minor) ? minor : void 0;
30
+ }
31
+ function formatMinorUnits(minor, locale, digits) {
32
+ const { decimal } = separators(locale);
33
+ const abs = BigInt(Math.abs(minor)).toString().padStart(digits + 1, "0");
34
+ const whole = new Intl.NumberFormat(locale).format(BigInt(digits ? abs.slice(0, -digits) : abs));
35
+ return `${minor < 0 ? "-" : ""}${whole}${digits ? decimal + abs.slice(-digits) : ""}`;
36
+ }
37
+ function MoneyInput({ value, onValueChange, currency, locale, currencies, onCurrencyChange, currencyLabel, invalid, className, onBlur, disabled, ...props }) {
38
+ const digits = currencyDigits(currency);
39
+ const [text, setText] = React.useState(() => value === null ? "" : formatMinorUnits(value, locale, digits));
40
+ const typed = React.useRef(value);
41
+ React.useEffect(() => {
42
+ if (typed.current !== value) setText(value === null ? "" : formatMinorUnits(value, locale, digits));
43
+ typed.current = value;
44
+ }, [value, locale, digits]);
45
+ return /* @__PURE__ */ jsxs("span", { className: cn("flex w-full items-stretch gap-2", className), children: [
46
+ /* @__PURE__ */ jsx(
47
+ Input,
48
+ {
49
+ ...props,
50
+ type: "text",
51
+ inputMode: digits ? "decimal" : "numeric",
52
+ autoComplete: "off",
53
+ disabled,
54
+ invalid,
55
+ "data-currency": currency,
56
+ value: text,
57
+ onChange: (event) => {
58
+ const parsed = parseMinorUnits(event.target.value, locale, digits);
59
+ if (parsed === void 0) return;
60
+ setText(event.target.value);
61
+ typed.current = parsed;
62
+ onValueChange(parsed);
63
+ },
64
+ onBlur: (event) => {
65
+ onBlur?.(event);
66
+ if (value !== null) setText(formatMinorUnits(value, locale, digits));
67
+ }
68
+ }
69
+ ),
70
+ currencies ? /* @__PURE__ */ jsx(Select, { "aria-label": currencyLabel, disabled, value: currency, onChange: (event) => onCurrencyChange?.(event.target.value), className: "w-28", children: currencies.map((code) => /* @__PURE__ */ jsx("option", { value: code, children: code }, code)) }) : /* @__PURE__ */ jsx("span", { className: "flex items-center text-sm font-medium text-fg-secondary", children: currency })
71
+ ] });
72
+ }
73
+ export {
74
+ MoneyInput,
75
+ formatMinorUnits,
76
+ parseMinorUnits
77
+ };
78
+ //# sourceMappingURL=money-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/money-input/money-input.tsx"],"sourcesContent":["// Client (the text being typed). An amount in INTEGER minor units (cents) plus a currency. The person types a\n// decimal in their locale's way; it is read as a string (never a float) into cents, refused beyond the currency's own\n// decimals, and written back grouped and padded on blur. The currency can be chosen among `currencies` (a native\n// select). Words arrive as props.\nimport { currencyDigits } from \"@krizaka/intl\";\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { Input, Select } from \"../field/field\";\n\nexport type MoneyInputProps = Omit<React.ComponentProps<\"input\">, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"inputMode\"> & {\n /** The amount in minor units (cents), an integer, or `null` when empty. */\n value: number | null;\n /** Called with the new amount in minor units, or `null` when the field is emptied. */\n onValueChange: (minorUnits: number | null) => void;\n /** ISO 4217 code: `\"CAD\"`. */\n currency: string;\n /** BCP 47 locale for the separators: `\"fr-CA\"`, `\"en-CA\"`. */\n locale: string;\n /** The currencies to choose among (ISO codes). Omitted: the currency is fixed. */\n currencies?: readonly string[];\n /** Called with the chosen currency (required with `currencies`). */\n onCurrencyChange?: (currency: string) => void;\n /** The currency select's accessible name, passed translated: \"Currency\". */\n currencyLabel?: string;\n /** Marks the amount invalid (pair it with a `Field.Error`). */\n invalid?: boolean;\n};\n\nconst separators = (locale: string) => {\n const parts = new Intl.NumberFormat(locale, { useGrouping: true, minimumFractionDigits: 1 }).formatToParts(1234567.1);\n return { decimal: parts.find((p) => p.type === \"decimal\")?.value ?? \".\", group: parts.find((p) => p.type === \"group\")?.value ?? \",\" };\n};\n\n/** \"12,50\" → 1250 without a float; `undefined` when the text is not an amount or has too many decimals. */\nexport function parseMinorUnits(text: string, locale: string, digits: number): number | null | undefined {\n const { decimal } = separators(locale);\n const cleaned = text.replace(/\\s/g, \"\");\n if (cleaned === \"\") return null;\n // The locale's decimal mark, and \".\" or \",\" as a typed alternative; any other mark is a thousands separator.\n const marks = [...cleaned].filter((c) => c === \".\" || c === \",\" || c === decimal);\n if (!/^[\\d.,]+$/.test(cleaned.replaceAll(decimal, \"\"))) return undefined;\n const last = marks.length ? Math.max(cleaned.lastIndexOf(\".\"), cleaned.lastIndexOf(\",\"), cleaned.lastIndexOf(decimal)) : -1;\n const whole = (last >= 0 ? cleaned.slice(0, last) : cleaned).replace(/\\D/g, \"\");\n const fraction = last >= 0 ? cleaned.slice(last + 1) : \"\";\n if (!/^\\d*$/.test(fraction) || fraction.length > digits || (digits === 0 && last >= 0)) return undefined;\n const minor = Number(`${whole || \"0\"}${fraction.padEnd(digits, \"0\")}`);\n return Number.isSafeInteger(minor) ? minor : undefined;\n}\n\n/** Minor units → \"1 234,50\" in the locale, exact (BigInt), padded to the currency's decimals. */\nexport function formatMinorUnits(minor: number, locale: string, digits: number): string {\n const { decimal } = separators(locale);\n const abs = BigInt(Math.abs(minor)).toString().padStart(digits + 1, \"0\");\n const whole = new Intl.NumberFormat(locale).format(BigInt(digits ? abs.slice(0, -digits) : abs));\n return `${minor < 0 ? \"-\" : \"\"}${whole}${digits ? decimal + abs.slice(-digits) : \"\"}`;\n}\n\n/** An amount field in minor units. The caller holds an integer; the person sees their locale's decimal. */\nexport function MoneyInput({ value, onValueChange, currency, locale, currencies, onCurrencyChange, currencyLabel, invalid, className, onBlur, disabled, ...props }: MoneyInputProps) {\n const digits = currencyDigits(currency);\n const [text, setText] = React.useState(() => (value === null ? \"\" : formatMinorUnits(value, locale, digits)));\n const typed = React.useRef<number | null>(value);\n // Follow the caller when the value changes from outside (a reset, another currency's digits).\n React.useEffect(() => {\n if (typed.current !== value) setText(value === null ? \"\" : formatMinorUnits(value, locale, digits));\n typed.current = value;\n }, [value, locale, digits]);\n return (\n <span className={cn(\"flex w-full items-stretch gap-2\", className)}>\n <Input\n {...props}\n type=\"text\"\n inputMode={digits ? \"decimal\" : \"numeric\"}\n autoComplete=\"off\"\n disabled={disabled}\n invalid={invalid}\n data-currency={currency}\n value={text}\n onChange={(event) => {\n const parsed = parseMinorUnits(event.target.value, locale, digits);\n if (parsed === undefined) return; // refused: not an amount, or more decimals than the currency has\n setText(event.target.value);\n typed.current = parsed;\n onValueChange(parsed);\n }}\n onBlur={(event) => {\n onBlur?.(event);\n if (value !== null) setText(formatMinorUnits(value, locale, digits));\n }}\n />\n {currencies ? (\n <Select aria-label={currencyLabel} disabled={disabled} value={currency} onChange={(event) => onCurrencyChange?.(event.target.value)} className=\"w-28\">\n {currencies.map((code) => (\n <option key={code} value={code}>\n {code}\n </option>\n ))}\n </Select>\n ) : (\n <span className=\"flex items-center text-sm font-medium text-fg-secondary\">{currency}</span>\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;AAIA,SAAS,sBAAsB;AAC/B,YAAY,WAAW;AAgEnB,SACE,KADF;AAxCJ,IAAM,aAAa,CAAC,WAAmB;AACrC,QAAM,QAAQ,IAAI,KAAK,aAAa,QAAQ,EAAE,aAAa,MAAM,uBAAuB,EAAE,CAAC,EAAE,cAAc,WAAS;AACpH,SAAO,EAAE,SAAS,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS,GAAG,SAAS,KAAK,OAAO,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,OAAO,GAAG,SAAS,IAAI;AACtI;AAGO,SAAS,gBAAgB,MAAc,QAAgB,QAA2C;AACvG,QAAM,EAAE,QAAQ,IAAI,WAAW,MAAM;AACrC,QAAM,UAAU,KAAK,QAAQ,OAAO,EAAE;AACtC,MAAI,YAAY,GAAI,QAAO;AAE3B,QAAM,QAAQ,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,MAAM,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO;AAChF,MAAI,CAAC,YAAY,KAAK,QAAQ,WAAW,SAAS,EAAE,CAAC,EAAG,QAAO;AAC/D,QAAM,OAAO,MAAM,SAAS,KAAK,IAAI,QAAQ,YAAY,GAAG,GAAG,QAAQ,YAAY,GAAG,GAAG,QAAQ,YAAY,OAAO,CAAC,IAAI;AACzH,QAAM,SAAS,QAAQ,IAAI,QAAQ,MAAM,GAAG,IAAI,IAAI,SAAS,QAAQ,OAAO,EAAE;AAC9E,QAAM,WAAW,QAAQ,IAAI,QAAQ,MAAM,OAAO,CAAC,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L,WAAW,SAAS,YAAY;AAAA,QAChC,cAAa;AAAA,QACb;AAAA,QACA;AAAA,QACA,iBAAe;AAAA,QACf,OAAO;AAAA,QACP,UAAU,CAAC,UAAU;AACnB,gBAAM,SAAS,gBAAgB,MAAM,OAAO,OAAO,QAAQ,MAAM;AACjE,cAAI,WAAW,OAAW;AAC1B,kBAAQ,MAAM,OAAO,KAAK;AAC1B,gBAAM,UAAU;AAChB,wBAAc,MAAM;AAAA,QACtB;AAAA,QACA,QAAQ,CAAC,UAAU;AACjB,mBAAS,KAAK;AACd,cAAI,UAAU,KAAM,SAAQ,iBAAiB,OAAO,QAAQ,MAAM,CAAC;AAAA,QACrE;AAAA;AAAA,IACF;AAAA,IACC,aACC,oBAAC,UAAO,cAAY,eAAe,UAAoB,OAAO,UAAU,UAAU,CAAC,UAAU,mBAAmB,MAAM,OAAO,KAAK,GAAG,WAAU,QAC5I,qBAAW,IAAI,CAAC,SACf,oBAAC,YAAkB,OAAO,MACvB,kBADU,IAEb,CACD,GACH,IAEA,oBAAC,UAAK,WAAU,2DAA2D,oBAAS;AAAA,KAExF;AAEJ;","names":[]}
package/dist/nav-bar.d.ts CHANGED
@@ -41,6 +41,11 @@ type NavBarSessionProps<TAccount = unknown> = {
41
41
  * @default "/api/me"
42
42
  */
43
43
  endpoint?: string;
44
+ /**
45
+ * The session the server already knows (a dynamic page reading its cookie): the first paint then IS the answer, with no
46
+ * placeholder and no swap. Leave it out on a static page; the bar reserves its place until the answer comes.
47
+ */
48
+ initial?: MeResponse<TAccount>;
44
49
  /** Signed out: the product's `ProductBarActions`, told whether sign-up is open. */
45
50
  signedOut: (state: {
46
51
  signupOpen: boolean;
@@ -55,11 +60,30 @@ type NavBarSessionProps<TAccount = unknown> = {
55
60
  className?: string;
56
61
  };
57
62
  declare const sessionKey: (endpoint: string) => readonly ["krizaka", "session", string];
63
+ /** What the bar knows of the visitor: `pending` is NOT « signed out » — nothing is drawn as either until the answer comes. */
64
+ type NavSession<TAccount = unknown> = {
65
+ status: "pending";
66
+ } | {
67
+ status: "in";
68
+ account: TAccount;
69
+ signupOpen: boolean;
70
+ } | {
71
+ status: "out";
72
+ signupOpen: boolean;
73
+ };
74
+ /**
75
+ * The one « who is here » reading of the family (the bar, a hero's action, a closing call all read this and so never
76
+ * disagree). Three rules, krizaka-ui#800: (1) `pending` is its own state, never drawn as signed out; (2) only an answer
77
+ * (`GET /api/me` 200) changes the state — a failed or throttled refetch keeps the last known state instead of flipping a
78
+ * signed-in person to « Sign in »; (3) with no answer at all (the first request failed) the visitor can still sign in.
79
+ */
80
+ declare function useNavSession<TAccount = unknown>(endpoint?: string, initial?: MeResponse<TAccount>): NavSession<TAccount>;
58
81
  /**
59
82
  * The bar's session island: put it in `NavBar.Actions`. While the answer is on its way it reserves the place and says
60
- * `hint` politely; if the request fails it shows the signed-out actions (the visitor can still sign in).
83
+ * `hint` politely (or, given `initial`, draws the server's answer at once); if the first request fails it shows the
84
+ * signed-out actions (the visitor can still sign in).
61
85
  */
62
- declare function NavBarSession<TAccount = unknown>({ endpoint, signedOut, signedIn, hint, className }: NavBarSessionProps<TAccount>): React.JSX.Element;
86
+ declare function NavBarSession<TAccount = unknown>({ endpoint, initial, signedOut, signedIn, hint, className }: NavBarSessionProps<TAccount>): React.JSX.Element;
63
87
 
64
88
  declare const navBar: tailwind_variants.TVReturnType<{
65
89
  floating: {
@@ -443,5 +467,5 @@ type ProductBarActionsProps = {
443
467
  /** The product bar's actions: use the app. Put it in `NavBar.Actions` (`placement="bar"`) or in `NavBar.Mobile` (`placement="panel"`). */
444
468
  declare function ProductBarActions({ signIn, tryIt, signupOpen, linkAs: Link, placement }: ProductBarActionsProps): React.JSX.Element;
445
469
 
446
- export { NavBar, NavBarActions, NavBarBadge, NavBarBrand, NavBarFamily, NavBarItems, NavBarLanguage, NavBarLink, NavBarMenu, NavBarMenuLink, NavBarMobile, NavBarMobileGroup, NavBarMobileLink, NavBarMobilePreferences, NavBarRepo, NavBarRoot, NavBarSession, ProductBarAction, ProductBarActions, meHeaders, meResponse, meSchema, navBar, placePanel, productBarActions, sessionKey };
447
- export type { MeResponse, NavBarBadgeProps, NavBarBrandProps, NavBarFamilyProps, NavBarItemsProps, NavBarLanguageProps, NavBarLinkProps, NavBarMenuLinkProps, NavBarMenuProps, NavBarMobileGroupProps, NavBarMobileLinkProps, NavBarMobilePreferencesProps, NavBarMobileProps, NavBarRepoProps, NavBarRootProps, NavBarSessionProps, PlacePanel, ProductBarActionsProps, ProductBarLink, ProductBarState };
470
+ export { NavBar, NavBarActions, NavBarBadge, NavBarBrand, NavBarFamily, NavBarItems, NavBarLanguage, NavBarLink, NavBarMenu, NavBarMenuLink, NavBarMobile, NavBarMobileGroup, NavBarMobileLink, NavBarMobilePreferences, NavBarRepo, NavBarRoot, NavBarSession, ProductBarAction, ProductBarActions, meHeaders, meResponse, meSchema, navBar, placePanel, productBarActions, sessionKey, useNavSession };
471
+ export type { MeResponse, NavBarBadgeProps, NavBarBrandProps, NavBarFamilyProps, NavBarItemsProps, NavBarLanguageProps, NavBarLinkProps, NavBarMenuLinkProps, NavBarMenuProps, NavBarMobileGroupProps, NavBarMobileLinkProps, NavBarMobilePreferencesProps, NavBarMobileProps, NavBarRepoProps, NavBarRootProps, NavBarSessionProps, NavSession, PlacePanel, ProductBarActionsProps, ProductBarLink, ProductBarState };
package/dist/nav-bar.js CHANGED
@@ -1,7 +1,4 @@
1
1
  "use client";
2
- import {
3
- LanguageSwitch
4
- } from "./chunk-VPO27AFS.js";
5
2
  import {
6
3
  FamilyMark,
7
4
  GitHubGlyph,
@@ -9,6 +6,9 @@ import {
9
6
  siteById,
10
7
  sitesByGroup
11
8
  } from "./chunk-Y5YBTHVD.js";
9
+ import {
10
+ LanguageSwitch
11
+ } from "./chunk-VPO27AFS.js";
12
12
  import {
13
13
  useSlidingIndicator
14
14
  } from "./chunk-4QN5YJ3D.js";
@@ -57,20 +57,29 @@ function placePanel({ trigger, root, panel, window: window2, gutter = 16 }) {
57
57
  import { krizakaFetch, useQuery } from "@krizaka/query";
58
58
  import { Fragment, jsx } from "react/jsx-runtime";
59
59
  var sessionKey = (endpoint) => ["krizaka", "session", endpoint];
60
- function NavBarSession({ endpoint = "/api/me", signedOut, signedIn, hint, className }) {
60
+ function useNavSession(endpoint = "/api/me", initial) {
61
61
  const { data, isPending, isError } = useQuery({
62
62
  queryKey: sessionKey(endpoint),
63
63
  queryFn: ({ signal }) => krizakaFetch(endpoint, { schema: meSchema, signal, cache: "no-store" }),
64
64
  staleTime: 3e4,
65
65
  retry: false,
66
- throwOnError: false
66
+ throwOnError: false,
67
+ ...initial ? { initialData: initial } : {}
67
68
  });
68
- if (isPending) {
69
+ if (data) {
70
+ const me = data;
71
+ return me.signedIn && me.account !== void 0 ? { status: "in", account: me.account, signupOpen: me.signupOpen } : { status: "out", signupOpen: me.signupOpen };
72
+ }
73
+ if (isPending && !isError) return { status: "pending" };
74
+ return { status: "out", signupOpen: false };
75
+ }
76
+ function NavBarSession({ endpoint = "/api/me", initial, signedOut, signedIn, hint, className }) {
77
+ const session = useNavSession(endpoint, initial);
78
+ if (session.status === "pending") {
69
79
  return /* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", "data-state": "loading", className, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: hint }) });
70
80
  }
71
- const me = !isError && data ? data : { signedIn: false, signupOpen: false };
72
- const state = { signupOpen: me.signupOpen };
73
- return /* @__PURE__ */ jsx(Fragment, { children: me.signedIn && me.account !== void 0 ? signedIn(me.account, state) : signedOut(state) });
81
+ const state = { signupOpen: session.signupOpen };
82
+ return /* @__PURE__ */ jsx(Fragment, { children: session.status === "in" ? signedIn(session.account, state) : signedOut(state) });
74
83
  }
75
84
 
76
85
  // src/nav-bar/nav-bar.tsx
@@ -444,6 +453,7 @@ export {
444
453
  navBar,
445
454
  placePanel,
446
455
  productBarActions,
447
- sessionKey
456
+ sessionKey,
457
+ useNavSession
448
458
  };
449
459
  //# sourceMappingURL=nav-bar.js.map