@hanzo/ui 8.9.3 → 8.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/backends/gui/breadcrumb.cjs +30 -0
  2. package/dist/backends/gui/breadcrumb.d.ts +32 -0
  3. package/dist/backends/gui/breadcrumb.d.ts.map +1 -0
  4. package/dist/backends/gui/breadcrumb.js +21 -0
  5. package/dist/backends/gui/breadcrumb.js.map +1 -0
  6. package/dist/backends/gui/drawer.cjs +183 -0
  7. package/dist/backends/gui/drawer.d.ts +49 -0
  8. package/dist/backends/gui/drawer.d.ts.map +1 -0
  9. package/dist/backends/gui/drawer.js +145 -0
  10. package/dist/backends/gui/drawer.js.map +1 -0
  11. package/dist/backends/gui/index.cjs +30 -1
  12. package/dist/backends/gui/index.d.ts +6 -0
  13. package/dist/backends/gui/index.d.ts.map +1 -1
  14. package/dist/backends/gui/index.js +6 -0
  15. package/dist/backends/gui/index.js.map +1 -1
  16. package/dist/backends/gui/input-otp.cjs +101 -0
  17. package/dist/backends/gui/input-otp.d.ts +37 -0
  18. package/dist/backends/gui/input-otp.d.ts.map +1 -0
  19. package/dist/backends/gui/input-otp.js +62 -0
  20. package/dist/backends/gui/input-otp.js.map +1 -0
  21. package/dist/backends/gui/link.cjs +3 -1
  22. package/dist/backends/gui/link.d.ts +7 -1
  23. package/dist/backends/gui/link.d.ts.map +1 -1
  24. package/dist/backends/gui/link.js +3 -1
  25. package/dist/backends/gui/link.js.map +1 -1
  26. package/dist/backends/gui/nav-items.cjs +13 -0
  27. package/dist/backends/gui/nav-items.d.ts +22 -0
  28. package/dist/backends/gui/nav-items.d.ts.map +1 -0
  29. package/dist/backends/gui/nav-items.js +10 -0
  30. package/dist/backends/gui/nav-items.js.map +1 -0
  31. package/dist/backends/gui/navigation-menu.cjs +97 -0
  32. package/dist/backends/gui/navigation-menu.d.ts +25 -0
  33. package/dist/backends/gui/navigation-menu.d.ts.map +1 -0
  34. package/dist/backends/gui/navigation-menu.js +55 -0
  35. package/dist/backends/gui/navigation-menu.js.map +1 -0
  36. package/dist/backends/gui/step-indicator.cjs +23 -0
  37. package/dist/backends/gui/step-indicator.d.ts +22 -0
  38. package/dist/backends/gui/step-indicator.d.ts.map +1 -0
  39. package/dist/backends/gui/step-indicator.js +20 -0
  40. package/dist/backends/gui/step-indicator.js.map +1 -0
  41. package/dist/gallery.html +16 -2
  42. package/dist/index.cjs +26 -2
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.node.js +1 -1
  48. package/dist/primitives/Breadcrumb.cjs +8 -0
  49. package/dist/primitives/Breadcrumb.d.ts +2 -0
  50. package/dist/primitives/Breadcrumb.d.ts.map +1 -0
  51. package/dist/primitives/Breadcrumb.js +5 -0
  52. package/dist/primitives/Breadcrumb.js.map +1 -0
  53. package/dist/primitives/BreadcrumbEllipsis.cjs +8 -0
  54. package/dist/primitives/BreadcrumbEllipsis.d.ts +2 -0
  55. package/dist/primitives/BreadcrumbEllipsis.d.ts.map +1 -0
  56. package/dist/primitives/BreadcrumbEllipsis.js +5 -0
  57. package/dist/primitives/BreadcrumbEllipsis.js.map +1 -0
  58. package/dist/primitives/BreadcrumbItem.cjs +8 -0
  59. package/dist/primitives/BreadcrumbItem.d.ts +2 -0
  60. package/dist/primitives/BreadcrumbItem.d.ts.map +1 -0
  61. package/dist/primitives/BreadcrumbItem.js +5 -0
  62. package/dist/primitives/BreadcrumbItem.js.map +1 -0
  63. package/dist/primitives/BreadcrumbLink.cjs +8 -0
  64. package/dist/primitives/BreadcrumbLink.d.ts +2 -0
  65. package/dist/primitives/BreadcrumbLink.d.ts.map +1 -0
  66. package/dist/primitives/BreadcrumbLink.js +5 -0
  67. package/dist/primitives/BreadcrumbLink.js.map +1 -0
  68. package/dist/primitives/BreadcrumbList.cjs +8 -0
  69. package/dist/primitives/BreadcrumbList.d.ts +2 -0
  70. package/dist/primitives/BreadcrumbList.d.ts.map +1 -0
  71. package/dist/primitives/BreadcrumbList.js +5 -0
  72. package/dist/primitives/BreadcrumbList.js.map +1 -0
  73. package/dist/primitives/BreadcrumbPage.cjs +8 -0
  74. package/dist/primitives/BreadcrumbPage.d.ts +2 -0
  75. package/dist/primitives/BreadcrumbPage.d.ts.map +1 -0
  76. package/dist/primitives/BreadcrumbPage.js +5 -0
  77. package/dist/primitives/BreadcrumbPage.js.map +1 -0
  78. package/dist/primitives/BreadcrumbSeparator.cjs +8 -0
  79. package/dist/primitives/BreadcrumbSeparator.d.ts +2 -0
  80. package/dist/primitives/BreadcrumbSeparator.d.ts.map +1 -0
  81. package/dist/primitives/BreadcrumbSeparator.js +5 -0
  82. package/dist/primitives/BreadcrumbSeparator.js.map +1 -0
  83. package/dist/primitives/Drawer.cjs +8 -0
  84. package/dist/primitives/Drawer.d.ts +2 -0
  85. package/dist/primitives/Drawer.d.ts.map +1 -0
  86. package/dist/primitives/Drawer.js +5 -0
  87. package/dist/primitives/Drawer.js.map +1 -0
  88. package/dist/primitives/DrawerContent.cjs +8 -0
  89. package/dist/primitives/DrawerContent.d.ts +2 -0
  90. package/dist/primitives/DrawerContent.d.ts.map +1 -0
  91. package/dist/primitives/DrawerContent.js +5 -0
  92. package/dist/primitives/DrawerContent.js.map +1 -0
  93. package/dist/primitives/DrawerHandle.cjs +8 -0
  94. package/dist/primitives/DrawerHandle.d.ts +2 -0
  95. package/dist/primitives/DrawerHandle.d.ts.map +1 -0
  96. package/dist/primitives/DrawerHandle.js +5 -0
  97. package/dist/primitives/DrawerHandle.js.map +1 -0
  98. package/dist/primitives/InputOTP.cjs +8 -0
  99. package/dist/primitives/InputOTP.d.ts +2 -0
  100. package/dist/primitives/InputOTP.d.ts.map +1 -0
  101. package/dist/primitives/InputOTP.js +5 -0
  102. package/dist/primitives/InputOTP.js.map +1 -0
  103. package/dist/primitives/InputOTPGroup.cjs +8 -0
  104. package/dist/primitives/InputOTPGroup.d.ts +2 -0
  105. package/dist/primitives/InputOTPGroup.d.ts.map +1 -0
  106. package/dist/primitives/InputOTPGroup.js +5 -0
  107. package/dist/primitives/InputOTPGroup.js.map +1 -0
  108. package/dist/primitives/InputOTPSeparator.cjs +8 -0
  109. package/dist/primitives/InputOTPSeparator.d.ts +2 -0
  110. package/dist/primitives/InputOTPSeparator.d.ts.map +1 -0
  111. package/dist/primitives/InputOTPSeparator.js +5 -0
  112. package/dist/primitives/InputOTPSeparator.js.map +1 -0
  113. package/dist/primitives/InputOTPSlot.cjs +8 -0
  114. package/dist/primitives/InputOTPSlot.d.ts +2 -0
  115. package/dist/primitives/InputOTPSlot.d.ts.map +1 -0
  116. package/dist/primitives/InputOTPSlot.js +5 -0
  117. package/dist/primitives/InputOTPSlot.js.map +1 -0
  118. package/dist/primitives/NavItems.cjs +8 -0
  119. package/dist/primitives/NavItems.d.ts +2 -0
  120. package/dist/primitives/NavItems.d.ts.map +1 -0
  121. package/dist/primitives/NavItems.js +5 -0
  122. package/dist/primitives/NavItems.js.map +1 -0
  123. package/dist/primitives/NavigationMenu.cjs +8 -0
  124. package/dist/primitives/NavigationMenu.d.ts +2 -0
  125. package/dist/primitives/NavigationMenu.d.ts.map +1 -0
  126. package/dist/primitives/NavigationMenu.js +5 -0
  127. package/dist/primitives/NavigationMenu.js.map +1 -0
  128. package/dist/primitives/NavigationMenuContent.cjs +8 -0
  129. package/dist/primitives/NavigationMenuContent.d.ts +2 -0
  130. package/dist/primitives/NavigationMenuContent.d.ts.map +1 -0
  131. package/dist/primitives/NavigationMenuContent.js +5 -0
  132. package/dist/primitives/NavigationMenuContent.js.map +1 -0
  133. package/dist/primitives/NavigationMenuItem.cjs +8 -0
  134. package/dist/primitives/NavigationMenuItem.d.ts +2 -0
  135. package/dist/primitives/NavigationMenuItem.d.ts.map +1 -0
  136. package/dist/primitives/NavigationMenuItem.js +5 -0
  137. package/dist/primitives/NavigationMenuItem.js.map +1 -0
  138. package/dist/primitives/NavigationMenuLink.cjs +8 -0
  139. package/dist/primitives/NavigationMenuLink.d.ts +2 -0
  140. package/dist/primitives/NavigationMenuLink.d.ts.map +1 -0
  141. package/dist/primitives/NavigationMenuLink.js +5 -0
  142. package/dist/primitives/NavigationMenuLink.js.map +1 -0
  143. package/dist/primitives/NavigationMenuList.cjs +8 -0
  144. package/dist/primitives/NavigationMenuList.d.ts +2 -0
  145. package/dist/primitives/NavigationMenuList.d.ts.map +1 -0
  146. package/dist/primitives/NavigationMenuList.js +5 -0
  147. package/dist/primitives/NavigationMenuList.js.map +1 -0
  148. package/dist/primitives/NavigationMenuTrigger.cjs +8 -0
  149. package/dist/primitives/NavigationMenuTrigger.d.ts +2 -0
  150. package/dist/primitives/NavigationMenuTrigger.d.ts.map +1 -0
  151. package/dist/primitives/NavigationMenuTrigger.js +5 -0
  152. package/dist/primitives/NavigationMenuTrigger.js.map +1 -0
  153. package/dist/primitives/StepIndicator.cjs +8 -0
  154. package/dist/primitives/StepIndicator.d.ts +2 -0
  155. package/dist/primitives/StepIndicator.d.ts.map +1 -0
  156. package/dist/primitives/StepIndicator.js +5 -0
  157. package/dist/primitives/StepIndicator.js.map +1 -0
  158. package/dist/primitives/navigationMenuTriggerStyle.cjs +8 -0
  159. package/dist/primitives/navigationMenuTriggerStyle.d.ts +2 -0
  160. package/dist/primitives/navigationMenuTriggerStyle.d.ts.map +1 -0
  161. package/dist/primitives/navigationMenuTriggerStyle.js +5 -0
  162. package/dist/primitives/navigationMenuTriggerStyle.js.map +1 -0
  163. package/dist/styles.css +15 -1
  164. package/dist/theme.css +15 -1
  165. package/dist/tw.cjs +7 -2
  166. package/dist/tw.d.ts.map +1 -1
  167. package/dist/tw.js +7 -2
  168. package/dist/tw.js.map +1 -1
  169. package/package.json +1 -1
@@ -0,0 +1,101 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.InputOTPSeparator = exports.InputOTPSlot = exports.InputOTPGroup = exports.InputOTP = void 0;
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ /**
40
+ * InputOTP — a one-time code, shown as separate boxes.
41
+ *
42
+ * ONE real `<input>` lies invisibly over the whole control and holds the entire
43
+ * value; the boxes are drawn from it. That is what makes paste, autofill,
44
+ * backspace-across-boxes, and the phone keyboard's "from Messages" suggestion
45
+ * work — all four break the moment the code is six separate inputs that hop
46
+ * focus between themselves, which is how this is usually built.
47
+ *
48
+ * It also means the caller's `onInput`/`onChange` see a normal input event with
49
+ * the whole code on it, which is what a form expects.
50
+ *
51
+ * `render` draws the boxes, because their GROUPING is a design decision — three
52
+ * and three, four and four, one run of six — and it is the caller's.
53
+ */
54
+ const React = __importStar(require("react"));
55
+ const box_1 = require("../../box.cjs");
56
+ const cn_1 = require("../../core/cn.cjs");
57
+ const InputOTP = ({ maxLength, render, className, value: controlled, onChange, onFocus, onBlur, ...props }) => {
58
+ const [held, setHeld] = React.useState('');
59
+ const value = String(controlled ?? held).slice(0, maxLength);
60
+ const [focused, setFocused] = React.useState(false);
61
+ const slots = Array.from({ length: maxLength }, (_, i) => ({
62
+ char: value[i] ?? null,
63
+ isActive: focused && i === Math.min(value.length, maxLength - 1),
64
+ hasFakeCaret: focused && i === value.length && i < maxLength,
65
+ }));
66
+ return ((0, jsx_runtime_1.jsxs)(box_1.Box, { className: (0, cn_1.cn)('relative grid grid-flow-col auto-cols-max items-center', className), children: [render({ slots }), (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "input",
67
+ // The phone keyboard's one-time-code suggestion is worth more than any
68
+ // amount of styling here, and it turns on these three attributes alone.
69
+ inputMode: "numeric", autoComplete: "one-time-code", maxLength: maxLength, ...props, value: value, onChange: (e) => {
70
+ if (controlled === undefined)
71
+ setHeld(e.target.value.slice(0, maxLength));
72
+ onChange?.(e);
73
+ }, onFocus: (e) => {
74
+ setFocused(true);
75
+ onFocus?.(e);
76
+ }, onBlur: (e) => {
77
+ setFocused(false);
78
+ onBlur?.(e);
79
+ }, style: {
80
+ // Over the boxes and transparent — so a click anywhere on the control
81
+ // focuses the thing that actually takes the keystrokes.
82
+ position: 'absolute',
83
+ inset: 0,
84
+ width: '100%',
85
+ height: '100%',
86
+ opacity: 0,
87
+ // The real caret would sit at the left edge of an invisible field,
88
+ // nowhere near the box it belongs to. The drawn one is in the slot.
89
+ caretColor: 'transparent',
90
+ } })] }));
91
+ };
92
+ exports.InputOTP = InputOTP;
93
+ const InputOTPGroup = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('grid grid-flow-col auto-cols-max items-center', className), ...props }));
94
+ exports.InputOTPGroup = InputOTPGroup;
95
+ const InputOTPSlot = ({ char, isActive, hasFakeCaret, className, ...props }) => ((0, jsx_runtime_1.jsxs)(box_1.Box
96
+ // Not focusable and not announced: the real input holds the value and the
97
+ // focus, and six boxes in the tab order would be six stops for one field.
98
+ , { "aria-hidden": "true", className: (0, cn_1.cn)('relative grid place-items-center w-10 h-10 border text-sm', isActive && 'border-foreground z-10', className), ...props, children: [char, hasFakeCaret && (0, jsx_runtime_1.jsx)(box_1.Box, { className: "hz-caret absolute", style: { width: 1, height: '1em' } })] }));
99
+ exports.InputOTPSlot = InputOTPSlot;
100
+ const InputOTPSeparator = ({ children, ...props }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { role: "separator", "aria-hidden": "true", ...props, children: children ?? '-' }));
101
+ exports.InputOTPSeparator = InputOTPSeparator;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * InputOTP — a one-time code, shown as separate boxes.
3
+ *
4
+ * ONE real `<input>` lies invisibly over the whole control and holds the entire
5
+ * value; the boxes are drawn from it. That is what makes paste, autofill,
6
+ * backspace-across-boxes, and the phone keyboard's "from Messages" suggestion
7
+ * work — all four break the moment the code is six separate inputs that hop
8
+ * focus between themselves, which is how this is usually built.
9
+ *
10
+ * It also means the caller's `onInput`/`onChange` see a normal input event with
11
+ * the whole code on it, which is what a form expects.
12
+ *
13
+ * `render` draws the boxes, because their GROUPING is a design decision — three
14
+ * and three, four and four, one run of six — and it is the caller's.
15
+ */
16
+ import * as React from 'react';
17
+ import { Box, type BoxProps } from '../../box.js';
18
+ /** One box's worth of state. */
19
+ export type OTPSlot = {
20
+ char: string | null;
21
+ /** The box the next keystroke lands in. */
22
+ isActive: boolean;
23
+ /** Draw a caret here — the real one is hidden with the real input. */
24
+ hasFakeCaret: boolean;
25
+ };
26
+ export type InputOTPProps = Omit<React.ComponentProps<'input'>, 'render' | 'children' | 'size'> & {
27
+ maxLength: number;
28
+ render: (props: {
29
+ slots: OTPSlot[];
30
+ }) => React.ReactNode;
31
+ className?: string;
32
+ };
33
+ export declare const InputOTP: ({ maxLength, render, className, value: controlled, onChange, onFocus, onBlur, ...props }: InputOTPProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const InputOTPGroup: ({ className, ...props }: React.ComponentProps<typeof Box>) => import("react/jsx-runtime").JSX.Element;
35
+ export declare const InputOTPSlot: ({ char, isActive, hasFakeCaret, className, ...props }: BoxProps & OTPSlot) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const InputOTPSeparator: ({ children, ...props }: React.ComponentProps<typeof Box>) => import("react/jsx-runtime").JSX.Element;
37
+ //# sourceMappingURL=input-otp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/input-otp.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAG9C,gCAAgC;AAChC,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,2CAA2C;IAC3C,QAAQ,EAAE,OAAO,CAAA;IACjB,sEAAsE;IACtE,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,GAAG;IAChG,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,OAAO,EAAE,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAA;IACxD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,QAAQ,6FASlB,aAAa,4CAqDf,CAAA;AAED,eAAO,MAAM,aAAa,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,4CAEtF,CAAA;AAED,eAAO,MAAM,YAAY,0DAMtB,QAAQ,GAAG,OAAO,4CAepB,CAAA;AAED,eAAO,MAAM,iBAAiB,2BAA4B,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,4CAIzF,CAAA"}
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * InputOTP — a one-time code, shown as separate boxes.
5
+ *
6
+ * ONE real `<input>` lies invisibly over the whole control and holds the entire
7
+ * value; the boxes are drawn from it. That is what makes paste, autofill,
8
+ * backspace-across-boxes, and the phone keyboard's "from Messages" suggestion
9
+ * work — all four break the moment the code is six separate inputs that hop
10
+ * focus between themselves, which is how this is usually built.
11
+ *
12
+ * It also means the caller's `onInput`/`onChange` see a normal input event with
13
+ * the whole code on it, which is what a form expects.
14
+ *
15
+ * `render` draws the boxes, because their GROUPING is a design decision — three
16
+ * and three, four and four, one run of six — and it is the caller's.
17
+ */
18
+ import * as React from 'react';
19
+ import { Box } from '../../box.js';
20
+ import { cn } from '../../core/cn.js';
21
+ export const InputOTP = ({ maxLength, render, className, value: controlled, onChange, onFocus, onBlur, ...props }) => {
22
+ const [held, setHeld] = React.useState('');
23
+ const value = String(controlled ?? held).slice(0, maxLength);
24
+ const [focused, setFocused] = React.useState(false);
25
+ const slots = Array.from({ length: maxLength }, (_, i) => ({
26
+ char: value[i] ?? null,
27
+ isActive: focused && i === Math.min(value.length, maxLength - 1),
28
+ hasFakeCaret: focused && i === value.length && i < maxLength,
29
+ }));
30
+ return (_jsxs(Box, { className: cn('relative grid grid-flow-col auto-cols-max items-center', className), children: [render({ slots }), _jsx(Box, { tag: "input",
31
+ // The phone keyboard's one-time-code suggestion is worth more than any
32
+ // amount of styling here, and it turns on these three attributes alone.
33
+ inputMode: "numeric", autoComplete: "one-time-code", maxLength: maxLength, ...props, value: value, onChange: (e) => {
34
+ if (controlled === undefined)
35
+ setHeld(e.target.value.slice(0, maxLength));
36
+ onChange?.(e);
37
+ }, onFocus: (e) => {
38
+ setFocused(true);
39
+ onFocus?.(e);
40
+ }, onBlur: (e) => {
41
+ setFocused(false);
42
+ onBlur?.(e);
43
+ }, style: {
44
+ // Over the boxes and transparent — so a click anywhere on the control
45
+ // focuses the thing that actually takes the keystrokes.
46
+ position: 'absolute',
47
+ inset: 0,
48
+ width: '100%',
49
+ height: '100%',
50
+ opacity: 0,
51
+ // The real caret would sit at the left edge of an invisible field,
52
+ // nowhere near the box it belongs to. The drawn one is in the slot.
53
+ caretColor: 'transparent',
54
+ } })] }));
55
+ };
56
+ export const InputOTPGroup = ({ className, ...props }) => (_jsx(Box, { className: cn('grid grid-flow-col auto-cols-max items-center', className), ...props }));
57
+ export const InputOTPSlot = ({ char, isActive, hasFakeCaret, className, ...props }) => (_jsxs(Box
58
+ // Not focusable and not announced: the real input holds the value and the
59
+ // focus, and six boxes in the tab order would be six stops for one field.
60
+ , { "aria-hidden": "true", className: cn('relative grid place-items-center w-10 h-10 border text-sm', isActive && 'border-foreground z-10', className), ...props, children: [char, hasFakeCaret && _jsx(Box, { className: "hz-caret absolute", style: { width: 1, height: '1em' } })] }));
61
+ export const InputOTPSeparator = ({ children, ...props }) => (_jsx(Box, { role: "separator", "aria-hidden": "true", ...props, children: children ?? '-' }));
62
+ //# sourceMappingURL=input-otp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-otp.js","sourceRoot":"","sources":["../../../src/backends/gui/input-otp.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAiB,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAiBlC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,MAAM,EACN,SAAS,EACT,KA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CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAI,IACtF,CACP,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAoC,EAAE,EAAE,CAAC,CAC7F,KAAC,GAAG,IAAC,IAAI,EAAC,WAAW,iBAAa,MAAM,KAAK,KAAK,YAC/C,QAAQ,IAAI,GAAG,GACZ,CACP,CAAA"}
@@ -91,10 +91,12 @@ exports.MDXLink = MDXLink;
91
91
  const LinkElement = ({ def,
92
92
  // No defaults on anything that also appears in `def` — a default here would
93
93
  // outrank the def it is supposed to fall back to.
94
- onClick, size, variant, icon, iconAfter, className, style, children, }) => {
94
+ onClick, size, variant, icon, iconAfter, className, style, children, 'aria-current': current, }) => {
95
95
  const Comp = (0, exports.useLink)();
96
96
  const { href, newTab, title } = def;
97
97
  const nav = {};
98
+ if (current)
99
+ nav['aria-current'] = current;
98
100
  if (external(href)) {
99
101
  nav.rel = 'noreferrer noopener';
100
102
  // An external link opens in a new tab unless the def says otherwise.
@@ -54,6 +54,12 @@ export type LinkElementProps = React.PropsWithChildren<{
54
54
  */
55
55
  className?: string;
56
56
  style?: React.CSSProperties;
57
+ /**
58
+ * `page` on the link to where you already are. It is how a screen reader
59
+ * says "this one" in a navigation list — the colour that marks it visually
60
+ * says nothing at all.
61
+ */
62
+ 'aria-current'?: 'page' | 'true' | false;
57
63
  }>;
58
64
  /**
59
65
  * A link wearing a button's clothes, described by a {@link LinkDef}.
@@ -61,5 +67,5 @@ export type LinkElementProps = React.PropsWithChildren<{
61
67
  * Given children, they replace the whole label — `title`, `icon` and
62
68
  * `iconAfter` are then ignored, since the caller has said what to render.
63
69
  */
64
- export declare const LinkElement: ({ def, onClick, size, variant, icon, iconAfter, className, style, children, }: LinkElementProps) => import("react/jsx-runtime").JSX.Element;
70
+ export declare const LinkElement: ({ def, onClick, size, variant, icon, iconAfter, className, style, children, 'aria-current': current, }: LinkElementProps) => import("react/jsx-runtime").JSX.Element;
65
71
  //# sourceMappingURL=link.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/link.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAkB,MAAM,UAAU,CAAA;AAE9E,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,IAAI,8BAA0D,CAAA;AAE3E,eAAO,MAAM,OAAO,QAAO,aAAuC,CAAA;AAKlE;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,gCAIjB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,4CAc/C,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,GAAG,EAAE,OAAO,CAAA;IACZ,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,uBAAuB;IACvB,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,uBAAuB;IACvB,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,uBAAuB;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kFAYrB,gBAAgB,4CAiDlB,CAAA"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/link.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAkB,MAAM,UAAU,CAAA;AAE9E,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,IAAI,8BAA0D,CAAA;AAE3E,eAAO,MAAM,OAAO,QAAO,aAAuC,CAAA;AAKlE;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,gCAIjB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,4CAc/C,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,GAAG,EAAE,OAAO,CAAA;IACZ,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,uBAAuB;IACvB,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,uBAAuB;IACvB,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,uBAAuB;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;CACzC,CAAC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,2GAarB,gBAAgB,4CAkDlB,CAAA"}
@@ -53,10 +53,12 @@ export const MDXLink = ({ href, children, ...rest }) => {
53
53
  export const LinkElement = ({ def,
54
54
  // No defaults on anything that also appears in `def` — a default here would
55
55
  // outrank the def it is supposed to fall back to.
56
- onClick, size, variant, icon, iconAfter, className, style, children, }) => {
56
+ onClick, size, variant, icon, iconAfter, className, style, children, 'aria-current': current, }) => {
57
57
  const Comp = useLink();
58
58
  const { href, newTab, title } = def;
59
59
  const nav = {};
60
+ if (current)
61
+ nav['aria-current'] = current;
60
62
  if (external(href)) {
61
63
  nav.rel = 'noreferrer noopener';
62
64
  // An external link opens in a new tab unless the def says otherwise.
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/backends/gui/link.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAElC,OAAO,EAAuC,cAAc,EAAE,MAAM,UAAU,CAAA;AAK9E;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,aAAa,CAAgB,GAAG,CAAC,CAAA;AAE3E,MAAM,CAAC,MAAM,OAAO,GAAG,GAAkB,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AAElE,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EACtB,IAAI,EACJ,QAAQ,EACR,GAAG,IAAI,EACuC,EAAE,EAAE;IAClD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,KAAM,IAAI,YACvB,QAAQ,GACJ,CACR,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C,KAC5B,GAAG,YAEN,KAAK,EAAE,GACH,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.NavItems = void 0;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const box_1 = require("../../box.cjs");
7
+ const cn_1 = require("../../core/cn.cjs");
8
+ const link_1 = require("./link.cjs");
9
+ const NavItems = ({ items, currentAs, as = 'nav', className, itemClx, onNavigate, }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: as, "aria-label": as === 'nav' ? 'Navigation' : undefined, className: (0, cn_1.cn)('grid grid-flow-col auto-cols-max items-center', className), children: items.map((def, i) => {
10
+ const current = !!currentAs && def.href === currentAs;
11
+ return ((0, jsx_runtime_1.jsx)(link_1.LinkElement, { def: def, onClick: onNavigate, "aria-current": current ? 'page' : false, className: (0, cn_1.cn)(typeof itemClx === 'function' ? itemClx(def) : itemClx) }, def.href || i));
12
+ }) }));
13
+ exports.NavItems = NavItems;
@@ -0,0 +1,22 @@
1
+ import { type ClassValue } from '../../core/cn.js';
2
+ import type { LinkDef } from '../../types.js';
3
+ export type NavItemsProps = {
4
+ items: LinkDef[];
5
+ /**
6
+ * The path you are on. The item whose href matches it is the current one.
7
+ * Absent, nothing is current — which is right for a footer.
8
+ */
9
+ currentAs?: string;
10
+ /** The element holding the list. `nav` unless it is not a navigation. */
11
+ as?: 'nav' | 'div' | 'ul';
12
+ className?: ClassValue;
13
+ /**
14
+ * A class for every item, or one worked out per item — a menu whose featured
15
+ * entries read differently from its ordinary ones needs the second.
16
+ */
17
+ itemClx?: string | ((def: LinkDef) => string);
18
+ /** Fires alongside the navigation — e.g. to close the menu it sits in. */
19
+ onNavigate?: () => void;
20
+ };
21
+ export declare const NavItems: ({ items, currentAs, as, className, itemClx, onNavigate, }: NavItemsProps) => import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=nav-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav-items.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/nav-items.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAM,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG1C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAC,CAAA;IAC7C,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,QAAQ,8DAOlB,aAAa,4CAqBf,CAAA"}
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Box } from '../../box.js';
4
+ import { cn } from '../../core/cn.js';
5
+ import { LinkElement } from './link.js';
6
+ export const NavItems = ({ items, currentAs, as = 'nav', className, itemClx, onNavigate, }) => (_jsx(Box, { tag: as, "aria-label": as === 'nav' ? 'Navigation' : undefined, className: cn('grid grid-flow-col auto-cols-max items-center', className), children: items.map((def, i) => {
7
+ const current = !!currentAs && def.href === currentAs;
8
+ return (_jsx(LinkElement, { def: def, onClick: onNavigate, "aria-current": current ? 'page' : false, className: cn(typeof itemClx === 'function' ? itemClx(def) : itemClx) }, def.href || i));
9
+ }) }));
10
+ //# sourceMappingURL=nav-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav-items.js","sourceRoot":"","sources":["../../../src/backends/gui/nav-items.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAcZ,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,EAAE,EAAmB,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAqBpC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,KAAK,EACL,SAAS,EACT,EAAE,GAAG,KAAK,EACV,SAAS,EACT,OAAO,EACP,UAAU,GACI,EAAE,EAAE,CAAC,CACnB,KAAC,GAAG,IACF,GAAG,EAAE,EAAE,gBAGK,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EACnD,SAAS,EAAE,EAAE,CAAC,+CAA+C,EAAE,SAAS,CAAC,YAExE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACpB,MAAM,OAAO,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAA;QACrD,OAAO,CACL,KAAC,WAAW,IAEV,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,UAAU,kBACL,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EACtC,SAAS,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAJhE,GAAG,CAAC,IAAI,IAAI,CAAC,CAKlB,CACH,CAAA;IACH,CAAC,CAAC,GACE,CACP,CAAA"}
@@ -0,0 +1,97 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.NavigationMenuLink = exports.NavigationMenuContent = exports.NavigationMenuTrigger = exports.navigationMenuTriggerStyle = exports.NavigationMenuItem = exports.NavigationMenuList = exports.NavigationMenu = void 0;
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ /**
40
+ * NavigationMenu — a site menu whose entries can open a panel.
41
+ *
42
+ * Each item owns its own open state and opens on hover OR focus, closing on
43
+ * leave or blur. Focus is not decoration here: a menu that opens only on hover
44
+ * is a menu a keyboard cannot reach, and the panel behind it is unreachable
45
+ * content rather than hidden content.
46
+ *
47
+ * A caller's own pointer handlers still run — several sites drive a shared
48
+ * backdrop from the same events — so they are chained, never replaced.
49
+ */
50
+ const React = __importStar(require("react"));
51
+ const box_1 = require("../../box.cjs");
52
+ const cn_1 = require("../../core/cn.cjs");
53
+ const Item = /* @__PURE__ */ React.createContext(null);
54
+ const useItem = () => React.useContext(Item);
55
+ /** Run the caller's handler after ours, never instead of it. */
56
+ const both = (ours, theirs) => (e) => {
57
+ ours(e);
58
+ theirs?.(e);
59
+ };
60
+ const NavigationMenu = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "nav", "aria-label": "Main", className: (0, cn_1.cn)('relative grid justify-center', className), ...props }));
61
+ exports.NavigationMenu = NavigationMenu;
62
+ const NavigationMenuList = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "ul", className: (0, cn_1.cn)('grid grid-flow-col auto-cols-max items-center gap-1', className), ...props }));
63
+ exports.NavigationMenuList = NavigationMenuList;
64
+ const NavigationMenuItem = ({ className, children, ...props }) => {
65
+ const [open, setOpen] = React.useState(false);
66
+ const id = React.useId();
67
+ return ((0, jsx_runtime_1.jsx)(Item.Provider, { value: { open, setOpen, id }, children: (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "li", className: (0, cn_1.cn)('relative', className),
68
+ // On the ITEM, not the trigger: the panel is a child of the item, so
69
+ // the pointer can travel from the trigger into the panel without ever
70
+ // leaving the item — which is what stops the menu closing under a
71
+ // cursor moving towards it.
72
+ onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), ...props, children: children }) }));
73
+ };
74
+ exports.NavigationMenuItem = NavigationMenuItem;
75
+ /**
76
+ * A stable class handle for hosts that hook menu triggers from CSS. Styling
77
+ * lives in the tokens; this only names the part.
78
+ */
79
+ const navigationMenuTriggerStyle = () => 'nav-menu-trigger';
80
+ exports.navigationMenuTriggerStyle = navigationMenuTriggerStyle;
81
+ const NavigationMenuTrigger = ({ className, children, onFocus, onBlur, onClick, ...props }) => {
82
+ const item = useItem();
83
+ return ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "button", type: "button", "aria-haspopup": "true", "aria-expanded": item?.open ?? false, "aria-controls": item?.id, className: (0, cn_1.cn)((0, exports.navigationMenuTriggerStyle)(), 'grid grid-flow-col auto-cols-max items-center gap-1', className), onFocus: both(() => item?.setOpen(true), onFocus), onBlur: both(() => item?.setOpen(false), onBlur),
84
+ // Touch has no hover. Without this the panel is unreachable on a phone —
85
+ // which is where most of these menus are actually read.
86
+ onClick: both(() => item?.setOpen(!item.open), onClick), ...props, children: children }));
87
+ };
88
+ exports.NavigationMenuTrigger = NavigationMenuTrigger;
89
+ const NavigationMenuContent = ({ className, children, ...props }) => {
90
+ const item = useItem();
91
+ if (item && !item.open)
92
+ return null;
93
+ return ((0, jsx_runtime_1.jsx)(box_1.Box, { id: item?.id, className: (0, cn_1.cn)('absolute top-full left-0', className), ...props, children: children }));
94
+ };
95
+ exports.NavigationMenuContent = NavigationMenuContent;
96
+ const NavigationMenuLink = ({ className, ...props }) => ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: "a", className: className, ...props }));
97
+ exports.NavigationMenuLink = NavigationMenuLink;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * NavigationMenu — a site menu whose entries can open a panel.
3
+ *
4
+ * Each item owns its own open state and opens on hover OR focus, closing on
5
+ * leave or blur. Focus is not decoration here: a menu that opens only on hover
6
+ * is a menu a keyboard cannot reach, and the panel behind it is unreachable
7
+ * content rather than hidden content.
8
+ *
9
+ * A caller's own pointer handlers still run — several sites drive a shared
10
+ * backdrop from the same events — so they are chained, never replaced.
11
+ */
12
+ import * as React from 'react';
13
+ import { Box, type BoxProps } from '../../box.js';
14
+ export declare const NavigationMenu: ({ className, ...props }: React.ComponentProps<typeof Box>) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const NavigationMenuList: ({ className, ...props }: React.ComponentProps<typeof Box>) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const NavigationMenuItem: ({ className, children, ...props }: React.ComponentProps<typeof Box>) => import("react/jsx-runtime").JSX.Element;
17
+ /**
18
+ * A stable class handle for hosts that hook menu triggers from CSS. Styling
19
+ * lives in the tokens; this only names the part.
20
+ */
21
+ export declare const navigationMenuTriggerStyle: () => string;
22
+ export declare const NavigationMenuTrigger: ({ className, children, onFocus, onBlur, onClick, ...props }: BoxProps<'button'>) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const NavigationMenuContent: ({ className, children, ...props }: React.ComponentProps<typeof Box>) => import("react/jsx-runtime").JSX.Element | null;
24
+ export declare const NavigationMenuLink: ({ className, ...props }: BoxProps<'a'>) => import("react/jsx-runtime").JSX.Element;
25
+ //# sourceMappingURL=navigation-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-menu.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/navigation-menu.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAqB9C,eAAO,MAAM,cAAc,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,4CAOvF,CAAA;AAED,eAAO,MAAM,kBAAkB,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,4CAM3F,CAAA;AAED,eAAO,MAAM,kBAAkB,sCAAuC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,4CAoBrG,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,cAA2B,CAAA;AAElE,eAAO,MAAM,qBAAqB,gEAO/B,QAAQ,CAAC,QAAQ,CAAC,4CAoBpB,CAAA;AAED,eAAO,MAAM,qBAAqB,sCAAuC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,mDAQxG,CAAA;AAED,eAAO,MAAM,kBAAkB,4BAA6B,QAAQ,CAAC,GAAG,CAAC,4CAExE,CAAA"}
@@ -0,0 +1,55 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * NavigationMenu — a site menu whose entries can open a panel.
5
+ *
6
+ * Each item owns its own open state and opens on hover OR focus, closing on
7
+ * leave or blur. Focus is not decoration here: a menu that opens only on hover
8
+ * is a menu a keyboard cannot reach, and the panel behind it is unreachable
9
+ * content rather than hidden content.
10
+ *
11
+ * A caller's own pointer handlers still run — several sites drive a shared
12
+ * backdrop from the same events — so they are chained, never replaced.
13
+ */
14
+ import * as React from 'react';
15
+ import { Box } from '../../box.js';
16
+ import { cn } from '../../core/cn.js';
17
+ const Item = /* @__PURE__ */ React.createContext(null);
18
+ const useItem = () => React.useContext(Item);
19
+ /** Run the caller's handler after ours, never instead of it. */
20
+ const both = (ours, theirs) => (e) => {
21
+ ours(e);
22
+ theirs?.(e);
23
+ };
24
+ export const NavigationMenu = ({ className, ...props }) => (_jsx(Box, { tag: "nav", "aria-label": "Main", className: cn('relative grid justify-center', className), ...props }));
25
+ export const NavigationMenuList = ({ className, ...props }) => (_jsx(Box, { tag: "ul", className: cn('grid grid-flow-col auto-cols-max items-center gap-1', className), ...props }));
26
+ export const NavigationMenuItem = ({ className, children, ...props }) => {
27
+ const [open, setOpen] = React.useState(false);
28
+ const id = React.useId();
29
+ return (_jsx(Item.Provider, { value: { open, setOpen, id }, children: _jsx(Box, { tag: "li", className: cn('relative', className),
30
+ // On the ITEM, not the trigger: the panel is a child of the item, so
31
+ // the pointer can travel from the trigger into the panel without ever
32
+ // leaving the item — which is what stops the menu closing under a
33
+ // cursor moving towards it.
34
+ onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), ...props, children: children }) }));
35
+ };
36
+ /**
37
+ * A stable class handle for hosts that hook menu triggers from CSS. Styling
38
+ * lives in the tokens; this only names the part.
39
+ */
40
+ export const navigationMenuTriggerStyle = () => 'nav-menu-trigger';
41
+ export const NavigationMenuTrigger = ({ className, children, onFocus, onBlur, onClick, ...props }) => {
42
+ const item = useItem();
43
+ return (_jsx(Box, { tag: "button", type: "button", "aria-haspopup": "true", "aria-expanded": item?.open ?? false, "aria-controls": item?.id, className: cn(navigationMenuTriggerStyle(), 'grid grid-flow-col auto-cols-max items-center gap-1', className), onFocus: both(() => item?.setOpen(true), onFocus), onBlur: both(() => item?.setOpen(false), onBlur),
44
+ // Touch has no hover. Without this the panel is unreachable on a phone —
45
+ // which is where most of these menus are actually read.
46
+ onClick: both(() => item?.setOpen(!item.open), onClick), ...props, children: children }));
47
+ };
48
+ export const NavigationMenuContent = ({ className, children, ...props }) => {
49
+ const item = useItem();
50
+ if (item && !item.open)
51
+ return null;
52
+ return (_jsx(Box, { id: item?.id, className: cn('absolute top-full left-0', className), ...props, children: children }));
53
+ };
54
+ export const NavigationMenuLink = ({ className, ...props }) => (_jsx(Box, { tag: "a", className: className, ...props }));
55
+ //# sourceMappingURL=navigation-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-menu.js","sourceRoot":"","sources":["../../../src/backends/gui/navigation-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAiB,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAQlC,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAAC,aAAa,CAAqB,IAAI,CAAC,CAAA;AAE1E,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AAE5C,gEAAgE;AAChE,MAAM,IAAI,GACR,CAAK,IAAoB,EAAE,MAAuB,EAAE,EAAE,CACtD,CAAC,CAAI,EAAE,EAAE;IACP,IAAI,CAAC,CAAC,CAAC,CAAA;IACP,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;AACb,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoC,EAAE,EAAE,CAAC,CAC3F,KAAC,GAAG,IACF,GAAG,EAAC,KAAK,gBACE,MAAM,EACjB,SAAS,EAAE,EAAE,CAAC,8BAA8B,EAAE,SAAS,CAAC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@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StepIndicator = void 0;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const box_1 = require("../../box.cjs");
7
+ const cn_1 = require("../../core/cn.cjs");
8
+ const StepIndicator = ({ steps, currentStep, dotSizeRem = 1, className, ...props }) => {
9
+ const dot = `${dotSizeRem}rem`;
10
+ return ((0, jsx_runtime_1.jsx)(box_1.Box, { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": steps.length - 1, "aria-valuenow": currentStep, "aria-valuetext": steps[currentStep], className: (0, cn_1.cn)('grid items-start', className),
11
+ // One column per step, each an equal share. A count is data, and data
12
+ // cannot be a class name.
13
+ style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, ...props, children: steps.map((name, i) => {
14
+ const done = i <= currentStep;
15
+ return ((0, jsx_runtime_1.jsxs)(box_1.Box, { className: "grid justify-items-center gap-1 relative", children: [i < steps.length - 1 && ((0, jsx_runtime_1.jsx)(box_1.Box, { "aria-hidden": "true", className: (0, cn_1.cn)('absolute', i < currentStep ? 'bg-foreground' : 'bg-muted'), style: {
16
+ height: 2,
17
+ top: `calc(${dot} / 2 - 1px)`,
18
+ left: '50%',
19
+ right: '-50%',
20
+ } })), (0, jsx_runtime_1.jsx)(box_1.Box, { "aria-hidden": "true", className: (0, cn_1.cn)('rounded-full relative', done ? 'bg-foreground' : 'bg-muted'), style: { width: dot, height: dot } }), (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "span", className: done ? 'text-foreground' : 'text-muted-foreground', children: name })] }, name));
21
+ }) }));
22
+ };
23
+ exports.StepIndicator = StepIndicator;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * StepIndicator — how far along a sequence you are.
3
+ *
4
+ * A dot per step joined by a rule, the ones behind you filled. It is a
5
+ * PROGRESSBAR, not a list of buttons: the steps are not reachable from here,
6
+ * and announcing them as controls invites a keyboard user to try.
7
+ *
8
+ * The dot size is a caller's number in rem, because this sits inside a checkout
9
+ * header whose height the caller owns — and because a dot that scales with the
10
+ * text is a dot that changes size when someone changes their type size.
11
+ */
12
+ import * as React from 'react';
13
+ import { Box } from '../../box.js';
14
+ export type StepIndicatorProps = Omit<React.ComponentProps<typeof Box>, 'children'> & {
15
+ steps: string[];
16
+ /** Zero-based. Steps before it are done; this one is current. */
17
+ currentStep: number;
18
+ /** Diameter, in rem. */
19
+ dotSizeRem?: number;
20
+ };
21
+ export declare const StepIndicator: ({ steps, currentStep, dotSizeRem, className, ...props }: StepIndicatorProps) => import("react/jsx-runtime").JSX.Element;
22
+ //# sourceMappingURL=step-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-indicator.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/step-indicator.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAG/B,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IACpF,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAA;IACnB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,aAAa,4DAMvB,kBAAkB,4CA8CpB,CAAA"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Box } from '../../box.js';
4
+ import { cn } from '../../core/cn.js';
5
+ export const StepIndicator = ({ steps, currentStep, dotSizeRem = 1, className, ...props }) => {
6
+ const dot = `${dotSizeRem}rem`;
7
+ return (_jsx(Box, { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": steps.length - 1, "aria-valuenow": currentStep, "aria-valuetext": steps[currentStep], className: cn('grid items-start', className),
8
+ // One column per step, each an equal share. A count is data, and data
9
+ // cannot be a class name.
10
+ style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, ...props, children: steps.map((name, i) => {
11
+ const done = i <= currentStep;
12
+ return (_jsxs(Box, { className: "grid justify-items-center gap-1 relative", children: [i < steps.length - 1 && (_jsx(Box, { "aria-hidden": "true", className: cn('absolute', i < currentStep ? 'bg-foreground' : 'bg-muted'), style: {
13
+ height: 2,
14
+ top: `calc(${dot} / 2 - 1px)`,
15
+ left: '50%',
16
+ right: '-50%',
17
+ } })), _jsx(Box, { "aria-hidden": "true", className: cn('rounded-full relative', done ? 'bg-foreground' : 'bg-muted'), style: { width: dot, height: dot } }), _jsx(Box, { tag: "span", className: done ? 'text-foreground' : 'text-muted-foreground', children: name })] }, name));
18
+ }) }));
19
+ };
20
+ //# sourceMappingURL=step-indicator.js.map