zjkm-ui 0.0.0-stage → 0.1.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 (186) hide show
  1. package/LICENSE +44 -0
  2. package/README.md +34 -2
  3. package/dist/accordion/accordion.d.ts +12 -0
  4. package/dist/accordion/accordion.js +20 -0
  5. package/dist/alert-dialog/alert-dialog.d.ts +15 -0
  6. package/dist/alert-dialog/alert-dialog.js +54 -0
  7. package/dist/animated-checkbox/animated-checkbox.d.ts +7 -0
  8. package/dist/animated-checkbox/animated-checkbox.js +17 -0
  9. package/dist/aurora-gradient/aurora-gradient.d.ts +10 -0
  10. package/dist/aurora-gradient/aurora-gradient.js +31 -0
  11. package/dist/auto-hide-navbar/auto-hide-navbar.d.ts +11 -0
  12. package/dist/auto-hide-navbar/auto-hide-navbar.js +33 -0
  13. package/dist/avatar-tooltip/avatar-tooltip.d.ts +14 -0
  14. package/dist/avatar-tooltip/avatar-tooltip.js +28 -0
  15. package/dist/blur-navbar/blur-navbar.d.ts +14 -0
  16. package/dist/blur-navbar/blur-navbar.js +33 -0
  17. package/dist/bot-avatars/bot-avatars.d.ts +9 -0
  18. package/dist/bot-avatars/bot-avatars.js +27 -0
  19. package/dist/bubble-slider/bubble-slider.d.ts +13 -0
  20. package/dist/bubble-slider/bubble-slider.js +51 -0
  21. package/dist/chart-lines/chart-lines.d.ts +10 -0
  22. package/dist/chart-lines/chart-lines.js +71 -0
  23. package/dist/chip-select/chip-select.d.ts +9 -0
  24. package/dist/chip-select/chip-select.js +29 -0
  25. package/dist/circular-progress/circular-progress.d.ts +11 -0
  26. package/dist/circular-progress/circular-progress.js +14 -0
  27. package/dist/citation-chips/citation-chips.d.ts +11 -0
  28. package/dist/citation-chips/citation-chips.js +45 -0
  29. package/dist/collapsible-sidebar/collapsible-sidebar.d.ts +15 -0
  30. package/dist/collapsible-sidebar/collapsible-sidebar.js +28 -0
  31. package/dist/count-up/count-up.d.ts +10 -0
  32. package/dist/count-up/count-up.js +55 -0
  33. package/dist/cursor-spotlight/cursor-spotlight.d.ts +10 -0
  34. package/dist/cursor-spotlight/cursor-spotlight.js +48 -0
  35. package/dist/cursor-tooltip/cursor-tooltip.d.ts +9 -0
  36. package/dist/cursor-tooltip/cursor-tooltip.js +31 -0
  37. package/dist/dock/dock.d.ts +14 -0
  38. package/dist/dock/dock.js +40 -0
  39. package/dist/dot-grid/dot-grid.d.ts +11 -0
  40. package/dist/dot-grid/dot-grid.js +82 -0
  41. package/dist/dot-pagination/dot-pagination.d.ts +10 -0
  42. package/dist/dot-pagination/dot-pagination.js +17 -0
  43. package/dist/drawer-sidebar/drawer-sidebar.d.ts +14 -0
  44. package/dist/drawer-sidebar/drawer-sidebar.js +34 -0
  45. package/dist/dual-range-slider/dual-range-slider.d.ts +13 -0
  46. package/dist/dual-range-slider/dual-range-slider.js +35 -0
  47. package/dist/exclusive-accordion/exclusive-accordion.d.ts +15 -0
  48. package/dist/exclusive-accordion/exclusive-accordion.js +38 -0
  49. package/dist/film-grain/film-grain.d.ts +9 -0
  50. package/dist/film-grain/film-grain.js +24 -0
  51. package/dist/floating-label-input/floating-label-input.d.ts +6 -0
  52. package/dist/floating-label-input/floating-label-input.js +26 -0
  53. package/dist/glow-button/glow-button.d.ts +6 -0
  54. package/dist/glow-button/glow-button.js +27 -0
  55. package/dist/gradient-slider/gradient-slider.d.ts +13 -0
  56. package/dist/gradient-slider/gradient-slider.js +24 -0
  57. package/dist/halftone-image/halftone-image.d.ts +14 -0
  58. package/dist/halftone-image/halftone-image.js +72 -0
  59. package/dist/hamburger-navbar/hamburger-navbar.d.ts +12 -0
  60. package/dist/hamburger-navbar/hamburger-navbar.js +35 -0
  61. package/dist/hold-to-confirm/hold-to-confirm.d.ts +13 -0
  62. package/dist/hold-to-confirm/hold-to-confirm.js +45 -0
  63. package/dist/horizontal-accordion/horizontal-accordion.d.ts +14 -0
  64. package/dist/horizontal-accordion/horizontal-accordion.js +28 -0
  65. package/dist/icon-toggle/icon-toggle.d.ts +10 -0
  66. package/dist/icon-toggle/icon-toggle.js +30 -0
  67. package/dist/indeterminate-progress/indeterminate-progress.d.ts +7 -0
  68. package/dist/indeterminate-progress/indeterminate-progress.js +16 -0
  69. package/dist/indicator-sidebar/indicator-sidebar.d.ts +11 -0
  70. package/dist/indicator-sidebar/indicator-sidebar.js +21 -0
  71. package/dist/inline-select/inline-select.d.ts +6 -0
  72. package/dist/inline-select/inline-select.js +14 -0
  73. package/dist/liquid-shapes/liquid-shapes.d.ts +10 -0
  74. package/dist/liquid-shapes/liquid-shapes.js +23 -0
  75. package/dist/load-more/load-more.d.ts +10 -0
  76. package/dist/load-more/load-more.js +18 -0
  77. package/dist/loading-button/loading-button.d.ts +6 -0
  78. package/dist/loading-button/loading-button.js +29 -0
  79. package/dist/loading-shimmer/loading-shimmer.d.ts +10 -0
  80. package/dist/loading-shimmer/loading-shimmer.js +17 -0
  81. package/dist/magnetic-button/magnetic-button.d.ts +9 -0
  82. package/dist/magnetic-button/magnetic-button.js +52 -0
  83. package/dist/nested-sidebar/nested-sidebar.d.ts +15 -0
  84. package/dist/nested-sidebar/nested-sidebar.js +38 -0
  85. package/dist/one-question-form/one-question-form.d.ts +13 -0
  86. package/dist/one-question-form/one-question-form.js +48 -0
  87. package/dist/otp-input/otp-input.d.ts +8 -0
  88. package/dist/otp-input/otp-input.js +52 -0
  89. package/dist/page-jump/page-jump.d.ts +9 -0
  90. package/dist/page-jump/page-jump.js +35 -0
  91. package/dist/pagination/pagination.d.ts +12 -0
  92. package/dist/pagination/pagination.js +27 -0
  93. package/dist/password-input/password-input.d.ts +9 -0
  94. package/dist/password-input/password-input.js +42 -0
  95. package/dist/pill-navbar/pill-navbar.d.ts +13 -0
  96. package/dist/pill-navbar/pill-navbar.js +43 -0
  97. package/dist/pixel-mosaic/pixel-mosaic-plain.d.ts +8 -0
  98. package/dist/pixel-mosaic/pixel-mosaic-plain.js +11 -0
  99. package/dist/pixel-mosaic/pixel-mosaic-plain.module.css +13 -0
  100. package/dist/pixel-mosaic/pixel-mosaic.d.ts +8 -0
  101. package/dist/pixel-mosaic/pixel-mosaic.js +10 -0
  102. package/dist/pixel-mosaic/use-pixel-mosaic.d.ts +21 -0
  103. package/dist/pixel-mosaic/use-pixel-mosaic.js +170 -0
  104. package/dist/plus-accordion/plus-accordion.d.ts +11 -0
  105. package/dist/plus-accordion/plus-accordion.js +24 -0
  106. package/dist/poll/poll.d.ts +9 -0
  107. package/dist/poll/poll.js +44 -0
  108. package/dist/press-button/press-button.d.ts +7 -0
  109. package/dist/press-button/press-button.js +17 -0
  110. package/dist/progress-bar/progress-bar.d.ts +10 -0
  111. package/dist/progress-bar/progress-bar.js +14 -0
  112. package/dist/promise-toast/promise-toast.d.ts +10 -0
  113. package/dist/promise-toast/promise-toast.js +54 -0
  114. package/dist/questionnaire/questionnaire.d.ts +16 -0
  115. package/dist/questionnaire/questionnaire.js +61 -0
  116. package/dist/quiz/quiz.d.ts +12 -0
  117. package/dist/quiz/quiz.js +58 -0
  118. package/dist/radio-cards/radio-cards.d.ts +15 -0
  119. package/dist/radio-cards/radio-cards.js +29 -0
  120. package/dist/radio-list/radio-list.d.ts +10 -0
  121. package/dist/radio-list/radio-list.js +28 -0
  122. package/dist/range-slider/range-slider.d.ts +13 -0
  123. package/dist/range-slider/range-slider.js +27 -0
  124. package/dist/rating-scale/rating-scale.d.ts +12 -0
  125. package/dist/rating-scale/rating-scale.js +33 -0
  126. package/dist/read-more/read-more.d.ts +8 -0
  127. package/dist/read-more/read-more.js +32 -0
  128. package/dist/resizable-sidebar/resizable-sidebar.d.ts +15 -0
  129. package/dist/resizable-sidebar/resizable-sidebar.js +48 -0
  130. package/dist/rich-select/rich-select.d.ts +16 -0
  131. package/dist/rich-select/rich-select.js +61 -0
  132. package/dist/rich-tooltip/rich-tooltip.d.ts +12 -0
  133. package/dist/rich-tooltip/rich-tooltip.js +50 -0
  134. package/dist/ripple-button/ripple-button.d.ts +6 -0
  135. package/dist/ripple-button/ripple-button.js +37 -0
  136. package/dist/scramble-text/scramble-text.d.ts +8 -0
  137. package/dist/scramble-text/scramble-text.js +59 -0
  138. package/dist/search-input/search-input.d.ts +7 -0
  139. package/dist/search-input/search-input.js +60 -0
  140. package/dist/searchable-select/searchable-select.d.ts +10 -0
  141. package/dist/searchable-select/searchable-select.js +66 -0
  142. package/dist/segmented-control/segmented-control.d.ts +9 -0
  143. package/dist/segmented-control/segmented-control.js +31 -0
  144. package/dist/segmented-progress/segmented-progress.d.ts +11 -0
  145. package/dist/segmented-progress/segmented-progress.js +16 -0
  146. package/dist/sheet-dialog/sheet-dialog.d.ts +9 -0
  147. package/dist/sheet-dialog/sheet-dialog.js +43 -0
  148. package/dist/shimmer-button/shimmer-button.d.ts +7 -0
  149. package/dist/shimmer-button/shimmer-button.js +22 -0
  150. package/dist/shortcut-tooltip/shortcut-tooltip.d.ts +14 -0
  151. package/dist/shortcut-tooltip/shortcut-tooltip.js +49 -0
  152. package/dist/simple-pagination/simple-pagination.d.ts +9 -0
  153. package/dist/simple-pagination/simple-pagination.js +18 -0
  154. package/dist/star-rating/star-rating.d.ts +11 -0
  155. package/dist/star-rating/star-rating.js +28 -0
  156. package/dist/step-progress/step-progress.d.ts +9 -0
  157. package/dist/step-progress/step-progress.js +24 -0
  158. package/dist/stepped-slider/stepped-slider.d.ts +10 -0
  159. package/dist/stepped-slider/stepped-slider.js +29 -0
  160. package/dist/styled-select/styled-select.d.ts +6 -0
  161. package/dist/styled-select/styled-select.js +23 -0
  162. package/dist/swatch-picker/swatch-picker.d.ts +14 -0
  163. package/dist/swatch-picker/swatch-picker.js +30 -0
  164. package/dist/swipe-toast/swipe-toast.d.ts +9 -0
  165. package/dist/swipe-toast/swipe-toast.js +59 -0
  166. package/dist/switch/switch.d.ts +11 -0
  167. package/dist/switch/switch.js +31 -0
  168. package/dist/tag-input/tag-input.d.ts +9 -0
  169. package/dist/tag-input/tag-input.js +48 -0
  170. package/dist/theme-toggle/theme-toggle.d.ts +11 -0
  171. package/dist/theme-toggle/theme-toggle.js +31 -0
  172. package/dist/timed-toast/timed-toast.d.ts +10 -0
  173. package/dist/timed-toast/timed-toast.js +33 -0
  174. package/dist/toaster/toaster.d.ts +14 -0
  175. package/dist/toaster/toaster.js +63 -0
  176. package/dist/toggle-group/toggle-group.d.ts +16 -0
  177. package/dist/toggle-group/toggle-group.js +27 -0
  178. package/dist/tooltip/tooltip.d.ts +11 -0
  179. package/dist/tooltip/tooltip.js +47 -0
  180. package/dist/type-to-confirm-dialog/type-to-confirm-dialog.d.ts +11 -0
  181. package/dist/type-to-confirm-dialog/type-to-confirm-dialog.js +65 -0
  182. package/dist/undo-toast/undo-toast.d.ts +9 -0
  183. package/dist/undo-toast/undo-toast.js +33 -0
  184. package/dist/zoom-dialog/zoom-dialog.d.ts +9 -0
  185. package/dist/zoom-dialog/zoom-dialog.js +51 -0
  186. package/package.json +47 -4
package/LICENSE ADDED
@@ -0,0 +1,44 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 zjkm.tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ "Commons Clause" License Condition v1.0
24
+
25
+ The Software is provided to you by the Licensor under the License, as defined
26
+ below, subject to the following condition.
27
+
28
+ Without limiting other conditions in the License, the grant of rights under the
29
+ License will not include, and the License does not grant to you, the right to
30
+ Sell the Software.
31
+
32
+ For purposes of the foregoing, "Sell" means practicing any or all of the rights
33
+ granted to you under the License to provide to third parties, for a fee or other
34
+ consideration (including without limitation fees for hosting or consulting/
35
+ support services related to the Software), a product or service whose value
36
+ derives, entirely or substantially, from the functionality of the Software. Any
37
+ license notice or attribution required by the License must also include this
38
+ Commons Clause License Condition notice.
39
+
40
+ Software: zjkm free components
41
+
42
+ License: MIT
43
+
44
+ Licensor: zjkm.tech
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # zjkm-ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Animated React components and effects: buttons, inputs, sliders, toasts, dialogs, navigation, accordions and backgrounds. Each component is one file with its own styles, so there's no CSS to set up. Every one is previewed, with a playground, at **[zjkm.tech](https://zjkm.tech)**.
4
+
5
+ ```sh
6
+ npm install zjkm-ui
7
+ ```
8
+
9
+ Import each component from its own path:
10
+
11
+ ```tsx
12
+ import { ShimmerButton } from "zjkm-ui/shimmer-button";
13
+ import { Toaster, toast } from "zjkm-ui/toaster";
14
+
15
+ export function Cta() {
16
+ return (
17
+ <>
18
+ <ShimmerButton onClick={() => toast("Saved")}>Get started</ShimmerButton>
19
+ <Toaster />
20
+ </>
21
+ );
22
+ }
23
+ ```
24
+
25
+ The path is the component's name in kebab case, the same as its docs URL: `zjkm.tech/docs/components/<name>`.
26
+
27
+ Requires React 19. Interactive components are marked `"use client"`, so they work in the Next.js App Router. They respect `prefers-reduced-motion`.
28
+
29
+ `zjkm-ui/pixel-mosaic` is styled with Tailwind classes. If you use it, add `@source "../node_modules/zjkm-ui/dist";` to your Tailwind CSS (adjust the path), or use `zjkm-ui/pixel-mosaic-plain`, which ships its own CSS module.
30
+
31
+ Prefer to own the code? Every component can also be copied into your project with the shadcn CLI. See the install tab on each docs page.
32
+
33
+ ## License
34
+
35
+ MIT + Commons Clause: free to use in your own and your clients' projects, but you may not sell the components themselves. See [LICENSE](./LICENSE) and [zjkm.tech/license](https://zjkm.tech/license).
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from "react";
2
+ export interface AccordionItem {
3
+ title: string;
4
+ content: ReactNode;
5
+ }
6
+ export interface AccordionProps {
7
+ items: AccordionItem[];
8
+ defaultOpen?: number[];
9
+ className?: string;
10
+ }
11
+ /** Sections that open and close smoothly. Native <details>, so it works without JavaScript and find-in-page opens it. */
12
+ export declare function Accordion({ items, defaultOpen, className }: AccordionProps): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const css = `
3
+ .zjkm-acc { border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent); }
4
+ .zjkm-acc > details { border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent); interpolate-size: allow-keywords; }
5
+ .zjkm-acc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; font-weight: 500; cursor: pointer; list-style: none; }
6
+ .zjkm-acc summary::-webkit-details-marker { display: none; }
7
+ .zjkm-acc summary:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; border-radius: 4px; }
8
+ .zjkm-acc__body { padding: 0 4px 16px; opacity: 0.85; }
9
+ /* Smooth height where the browser supports animating to auto; elsewhere it opens at once. */
10
+ .zjkm-acc > details::details-content { height: 0; overflow: clip; transition: height 0.25s ease-out, content-visibility 0.25s allow-discrete; }
11
+ .zjkm-acc > details[open]::details-content { height: auto; }
12
+ @media (prefers-reduced-motion: reduce) { .zjkm-acc > details::details-content { transition: none; } }
13
+ .zjkm-acc summary::after { content: ""; width: 16px; height: 16px; flex: none; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 9C18 9 13.5811 15 12 15C10.4188 15 6 9 6 9'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 9C18 9 13.5811 15 12 15C10.4188 15 6 9 6 9'/%3E%3C/svg%3E") center / contain no-repeat; opacity: 0.6; transition: transform 0.2s; }
14
+ .zjkm-acc details[open] > summary::after { transform: rotate(180deg); }
15
+ @media (prefers-reduced-motion: reduce) { .zjkm-acc summary::after { transition: none; } }
16
+ `;
17
+ /** Sections that open and close smoothly. Native <details>, so it works without JavaScript and find-in-page opens it. */
18
+ export function Accordion({ items, defaultOpen = [], className }) {
19
+ return (_jsxs("div", { className: className ? `zjkm-acc ${className}` : "zjkm-acc", children: [_jsx("style", { href: "zjkm-accordion", precedence: "default", children: css }), items.map((item, i) => (_jsxs("details", { open: defaultOpen.includes(i), children: [_jsx("summary", { children: item.title }), _jsx("div", { className: "zjkm-acc__body", children: item.content })] }, item.title)))] }));
20
+ }
@@ -0,0 +1,15 @@
1
+ export interface AlertDialogProps {
2
+ open: boolean;
3
+ title: string;
4
+ description: string;
5
+ confirmLabel?: string;
6
+ cancelLabel?: string;
7
+ tone?: "default" | "danger";
8
+ onConfirm: () => void;
9
+ onCancel: () => void;
10
+ }
11
+ /**
12
+ * Asks to confirm or cancel. A native modal <dialog> with role="alertdialog": focus is trapped inside,
13
+ * Escape cancels, and Cancel takes focus first, so a stray Enter never confirms.
14
+ */
15
+ export declare function AlertDialog({ open, title, description, confirmLabel, cancelLabel, tone, onConfirm, onCancel }: AlertDialogProps): import("react").JSX.Element;
@@ -0,0 +1,54 @@
1
+ // zjkm Alert Dialog · https://zjkm.tech/docs/components/alert-dialog
2
+ // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useId, useRef } from "react";
6
+ const css = `
7
+ /* margin: auto centres a modal dialog; CSS resets that zero every margin would pin it to the corner. */
8
+ .zjkm-dlg {
9
+ width: min(420px, calc(100vw - 32px)); margin: auto; padding: 20px; border: 0; border-radius: 16px;
10
+ background: var(--zjkm-dlg-bg, Canvas); color: inherit; box-shadow: 0 0 0 1px color-mix(in srgb, CanvasText 10%, transparent), 0 24px 64px -12px rgb(0 0 0 / 0.5);
11
+ }
12
+ .zjkm-dlg[open] { animation: zjkm-dlg-in 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
13
+ .zjkm-dlg::backdrop { background: rgb(0 0 0 / 0.5); animation: zjkm-dlg-fade 0.2s; }
14
+ .zjkm-dlg h2 { margin: 0 0 6px; font-size: 18px; }
15
+ .zjkm-dlg p { margin: 0; opacity: 0.8; font-size: 14px; }
16
+ .zjkm-dlg__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
17
+ .zjkm-dlg button:hover:not(:disabled) { filter: brightness(1.1); }
18
+ .zjkm-dlg button {
19
+ padding: 8px 14px; border: 1px solid color-mix(in srgb, currentColor 20%, transparent); border-radius: 8px;
20
+ background: transparent; color: inherit; font: inherit; font-size: 14px; cursor: pointer;
21
+ }
22
+ .zjkm-dlg button[data-primary] { border-color: transparent; background: CanvasText; color: Canvas; }
23
+ .zjkm-dlg[data-tone="danger"] button[data-primary] { background: #b91c1c; color: #fff; }
24
+ .zjkm-dlg button:disabled { opacity: 0.45; cursor: not-allowed; }
25
+ .zjkm-dlg :is(button, input):focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
26
+ @keyframes zjkm-dlg-in { from { opacity: 0; transform: scale(0.95); } }
27
+ @keyframes zjkm-dlg-fade { from { opacity: 0; } }
28
+ @media (prefers-reduced-motion: reduce) { .zjkm-dlg[open], .zjkm-dlg::backdrop { animation: none; } }
29
+ `;
30
+ function useModal(open) {
31
+ const ref = useRef(null);
32
+ useEffect(() => {
33
+ const d = ref.current;
34
+ if (!d)
35
+ return;
36
+ if (open && !d.open)
37
+ d.showModal();
38
+ if (!open && d.open)
39
+ d.close();
40
+ }, [open]);
41
+ return ref;
42
+ }
43
+ /**
44
+ * Asks to confirm or cancel. A native modal <dialog> with role="alertdialog": focus is trapped inside,
45
+ * Escape cancels, and Cancel takes focus first, so a stray Enter never confirms.
46
+ */
47
+ export function AlertDialog({ open, title, description, confirmLabel = "Confirm", cancelLabel = "Cancel", tone = "default", onConfirm, onCancel }) {
48
+ const id = useId();
49
+ const ref = useModal(open);
50
+ return (_jsxs("dialog", { ref: ref, role: "alertdialog", "aria-labelledby": `${id}-t`, "aria-describedby": `${id}-d`, className: "zjkm-dlg", "data-tone": tone, onCancel: (e) => {
51
+ e.preventDefault();
52
+ onCancel();
53
+ }, children: [_jsx("style", { href: "zjkm-alert-dialog", precedence: "default", children: css }), _jsx("h2", { id: `${id}-t`, children: title }), _jsx("p", { id: `${id}-d`, children: description }), _jsxs("div", { className: "zjkm-dlg__actions", children: [_jsx("button", { type: "button", autoFocus: true, onClick: onCancel, children: cancelLabel }), _jsx("button", { type: "button", "data-primary": "", onClick: onConfirm, children: confirmLabel })] })] }));
54
+ }
@@ -0,0 +1,7 @@
1
+ import type { ComponentProps, ReactNode } from "react";
2
+ export interface AnimatedCheckboxProps extends Omit<ComponentProps<"input">, "type"> {
3
+ children: ReactNode;
4
+ color?: string;
5
+ }
6
+ /** A native checkbox drawn as a box whose tick draws itself when checked. */
7
+ export declare function AnimatedCheckbox({ children, color, className, style, ...props }: AnimatedCheckboxProps): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const css = `
3
+ .zjkm-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
4
+ .zjkm-check > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
5
+ .zjkm-check > svg { width: 20px; height: 20px; flex: none; overflow: visible; }
6
+ .zjkm-check__box { fill: transparent; stroke: color-mix(in srgb, currentColor 40%, transparent); stroke-width: 2; transition: fill 0.2s, stroke 0.2s; }
7
+ .zjkm-check__tick { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.25s 0.05s ease-out; }
8
+ .zjkm-check > input:checked + svg .zjkm-check__box { fill: var(--zjkm-check-color); stroke: var(--zjkm-check-color); }
9
+ .zjkm-check > input:checked + svg .zjkm-check__tick { stroke-dashoffset: 0; }
10
+ .zjkm-check > input:focus-visible + svg { outline: 2px solid var(--zjkm-check-color); outline-offset: 2px; border-radius: 4px; }
11
+ .zjkm-check > input:disabled + svg { opacity: 0.5; }
12
+ @media (prefers-reduced-motion: reduce) { .zjkm-check__box, .zjkm-check__tick { transition: none; } }
13
+ `;
14
+ /** A native checkbox drawn as a box whose tick draws itself when checked. */
15
+ export function AnimatedCheckbox({ children, color = "#6366f1", className, style, ...props }) {
16
+ return (_jsxs("label", { className: className ? `zjkm-check ${className}` : "zjkm-check", style: { "--zjkm-check-color": color, ...style }, children: [_jsx("style", { href: "zjkm-animated-checkbox", precedence: "default", children: css }), _jsx("input", { type: "checkbox", ...props }), _jsxs("svg", { viewBox: "0 0 20 20", "aria-hidden": "true", children: [_jsx("rect", { className: "zjkm-check__box", x: "1", y: "1", width: "18", height: "18", rx: "5" }), _jsx("path", { className: "zjkm-check__tick", d: "M5.8 11.2L7.9 13.3L14.2 6.7", pathLength: "1" })] }), children] }));
17
+ }
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ export interface AuroraGradientProps {
3
+ children?: ReactNode;
4
+ colors?: [string, string, string];
5
+ speed?: number;
6
+ blur?: number;
7
+ className?: string;
8
+ }
9
+ /** Soft blurred colour fields that drift slowly behind your content. */
10
+ export declare function AuroraGradient({ children, colors, speed, blur, className, }: AuroraGradientProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const css = `
3
+ .zjkm-aurora { position: relative; isolation: isolate; overflow: hidden; }
4
+ .zjkm-aurora__sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; filter: blur(var(--zjkm-aurora-blur)); }
5
+ .zjkm-aurora__sky > span {
6
+ position: absolute; width: 60%; aspect-ratio: 1; border-radius: 50%; opacity: 0.65;
7
+ animation: zjkm-aurora-a var(--zjkm-aurora-speed) ease-in-out infinite alternate;
8
+ }
9
+ .zjkm-aurora__sky > span:nth-child(1) { background: var(--zjkm-aurora-1); top: -25%; left: -10%; }
10
+ .zjkm-aurora__sky > span:nth-child(2) {
11
+ background: var(--zjkm-aurora-2); top: 5%; right: -15%;
12
+ animation-name: zjkm-aurora-b; animation-delay: calc(var(--zjkm-aurora-speed) * -0.4);
13
+ }
14
+ .zjkm-aurora__sky > span:nth-child(3) {
15
+ background: var(--zjkm-aurora-3); bottom: -35%; left: 20%; animation-delay: calc(var(--zjkm-aurora-speed) * -0.7);
16
+ }
17
+ @keyframes zjkm-aurora-a { to { transform: translate(20%, 15%) scale(1.25) rotate(40deg); } }
18
+ @keyframes zjkm-aurora-b { to { transform: translate(-25%, 12%) scale(0.85) rotate(-30deg); } }
19
+ @media (prefers-reduced-motion: reduce) { .zjkm-aurora__sky > span { animation: none; } }
20
+ `;
21
+ /** Soft blurred colour fields that drift slowly behind your content. */
22
+ export function AuroraGradient({ children, colors = ["#22d3ee", "#a78bfa", "#34d399"], speed = 12, blur = 60, className, }) {
23
+ const style = {
24
+ "--zjkm-aurora-1": colors[0],
25
+ "--zjkm-aurora-2": colors[1],
26
+ "--zjkm-aurora-3": colors[2],
27
+ "--zjkm-aurora-speed": `${speed}s`,
28
+ "--zjkm-aurora-blur": `${blur}px`,
29
+ };
30
+ return (_jsxs("div", { className: className ? `zjkm-aurora ${className}` : "zjkm-aurora", style: style, children: [_jsx("style", { href: "zjkm-aurora-gradient", precedence: "default", children: css }), _jsxs("div", { className: "zjkm-aurora__sky", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), children] }));
31
+ }
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ export interface AutoHideNavbarProps {
3
+ children: ReactNode;
4
+ threshold?: number;
5
+ className?: string;
6
+ }
7
+ /**
8
+ * Wraps your navbar so it slides away as you scroll down and comes back as soon as you scroll up.
9
+ * It never hides while something inside it has keyboard focus.
10
+ */
11
+ export declare function AutoHideNavbar({ children, threshold, className }: AutoHideNavbarProps): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ // zjkm Auto-hide Navbar · https://zjkm.tech/docs/components/auto-hide-navbar
2
+ // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useState } from "react";
6
+ const css = `
7
+ .zjkm-ahnav {
8
+ position: sticky; top: 0; z-index: 30; background: var(--zjkm-ahnav-bg, Canvas);
9
+ border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent); transition: transform 0.25s ease-out;
10
+ }
11
+ .zjkm-ahnav[data-hidden]:not(:focus-within) { transform: translateY(-100%); }
12
+ @media (prefers-reduced-motion: reduce) { .zjkm-ahnav { transition: none; } }
13
+ `;
14
+ /**
15
+ * Wraps your navbar so it slides away as you scroll down and comes back as soon as you scroll up.
16
+ * It never hides while something inside it has keyboard focus.
17
+ */
18
+ export function AutoHideNavbar({ children, threshold = 64, className }) {
19
+ const [hidden, setHidden] = useState(false);
20
+ useEffect(() => {
21
+ let last = scrollY;
22
+ const onScroll = () => {
23
+ const y = scrollY;
24
+ if (Math.abs(y - last) < 4)
25
+ return; // ignore jitter
26
+ setHidden(y > last && y > threshold);
27
+ last = y;
28
+ };
29
+ addEventListener("scroll", onScroll, { passive: true });
30
+ return () => removeEventListener("scroll", onScroll);
31
+ }, [threshold]);
32
+ return (_jsxs("header", { className: className ? `zjkm-ahnav ${className}` : "zjkm-ahnav", "data-hidden": hidden ? "" : undefined, children: [_jsx("style", { href: "zjkm-auto-hide-navbar", precedence: "default", children: css }), children] }));
33
+ }
@@ -0,0 +1,14 @@
1
+ export interface Person {
2
+ name: string;
3
+ src?: string;
4
+ color?: string;
5
+ }
6
+ export interface AvatarStackProps {
7
+ people: Person[];
8
+ max?: number;
9
+ size?: number;
10
+ label?: string;
11
+ className?: string;
12
+ }
13
+ /** Overlapping avatars with each name shown on hover, and "+N" for the rest. Every avatar is named for screen readers. */
14
+ export declare function AvatarStack({ people, max, size, label, className }: AvatarStackProps): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const css = `
3
+ .zjkm-avatars { display: flex; margin: 0; padding: 0 0 0 8px; list-style: none; }
4
+ .zjkm-avatars > li { position: relative; margin-left: -8px; }
5
+ .zjkm-avatar {
6
+ display: grid; place-items: center; width: var(--zjkm-avatar-size); height: var(--zjkm-avatar-size); overflow: hidden; border-radius: 50%;
7
+ box-shadow: 0 0 0 2px var(--zjkm-avatar-ring, Canvas); background: var(--c, #4f46e5); color: #fff; font-size: calc(var(--zjkm-avatar-size) * 0.38); font-weight: 600;
8
+ transition: transform 0.15s;
9
+ }
10
+ .zjkm-avatar img { width: 100%; height: 100%; object-fit: cover; }
11
+ .zjkm-avatars > li:hover { z-index: 1; }
12
+ .zjkm-avatars > li:hover .zjkm-avatar { transform: translateY(-3px); }
13
+ .zjkm-avatars__name {
14
+ position: absolute; left: 50%; bottom: calc(100% + 8px); padding: 3px 8px; border-radius: 6px; background: #18181b; color: #fafafa;
15
+ font-size: 12px; white-space: nowrap; transform: translateX(-50%); opacity: 0;
16
+ box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1), 0 8px 20px -6px rgb(0 0 0 / 0.4); pointer-events: none; transition: opacity 0.15s;
17
+ }
18
+ .zjkm-avatars > li:hover .zjkm-avatars__name { opacity: 1; }
19
+ .zjkm-avatars__more { background: color-mix(in srgb, currentColor 18%, Canvas); color: inherit; }
20
+ @media (prefers-reduced-motion: reduce) { .zjkm-avatar, .zjkm-avatars__name { transition: none; } .zjkm-avatars > li:hover .zjkm-avatar { transform: none; } }
21
+ `;
22
+ const initials = (name) => name.split(/\s+/).map((w) => w[0]).slice(0, 2).join("").toUpperCase();
23
+ /** Overlapping avatars with each name shown on hover, and "+N" for the rest. Every avatar is named for screen readers. */
24
+ export function AvatarStack({ people, max = 5, size = 36, label = "People", className }) {
25
+ const shown = people.slice(0, max);
26
+ const rest = people.length - shown.length;
27
+ return (_jsxs("ul", { "aria-label": label, className: className ? `zjkm-avatars ${className}` : "zjkm-avatars", style: { "--zjkm-avatar-size": `${size}px` }, children: [_jsx("style", { href: "zjkm-avatar-stack", precedence: "default", children: css }), shown.map((p) => (_jsxs("li", { children: [_jsx("span", { className: "zjkm-avatar", role: "img", "aria-label": p.name, style: { "--c": p.color }, children: p.src ? _jsx("img", { src: p.src, alt: "" }) : initials(p.name) }), _jsx("span", { className: "zjkm-avatars__name", "aria-hidden": "true", children: p.name })] }, p.name))), rest > 0 && (_jsx("li", { children: _jsxs("span", { className: "zjkm-avatar zjkm-avatars__more", role: "img", "aria-label": `and ${rest} more`, children: ["+", rest] }) }))] }));
28
+ }
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ export interface NavLink {
3
+ label: string;
4
+ href: string;
5
+ }
6
+ export interface BlurNavbarProps {
7
+ brand: ReactNode;
8
+ links: NavLink[];
9
+ current?: string;
10
+ actions?: ReactNode;
11
+ className?: string;
12
+ }
13
+ /** A sticky navbar that's clear at the top of the page and frosts over the content once you scroll. */
14
+ export declare function BlurNavbar({ brand, links, current, actions, className }: BlurNavbarProps): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ // zjkm Blur Navbar · https://zjkm.tech/docs/components/blur-navbar
2
+ // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useState } from "react";
6
+ const css = `
7
+ .zjkm-bnav {
8
+ position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 24px; padding: 12px 20px;
9
+ border-bottom: 1px solid transparent; transition: background 0.2s, border-color 0.2s, backdrop-filter 0.2s;
10
+ }
11
+ .zjkm-bnav[data-scrolled] {
12
+ background: color-mix(in srgb, var(--zjkm-bnav-bg, Canvas) 70%, transparent); backdrop-filter: blur(12px) saturate(1.4);
13
+ border-color: color-mix(in srgb, currentColor 10%, transparent);
14
+ }
15
+ .zjkm-bnav__brand { font-weight: 700; }
16
+ .zjkm-bnav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
17
+ .zjkm-bnav a { padding: 6px 10px; border-radius: 6px; color: inherit; text-decoration: none; font-size: 14px; opacity: 0.8; }
18
+ .zjkm-bnav a:hover, .zjkm-bnav a[aria-current="page"] { opacity: 1; }
19
+ .zjkm-bnav a:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
20
+ .zjkm-bnav__actions { margin-left: auto; }
21
+ @media (prefers-reduced-motion: reduce) { .zjkm-bnav { transition: none; } }
22
+ `;
23
+ /** A sticky navbar that's clear at the top of the page and frosts over the content once you scroll. */
24
+ export function BlurNavbar({ brand, links, current, actions, className }) {
25
+ const [scrolled, setScrolled] = useState(false);
26
+ useEffect(() => {
27
+ const check = () => setScrolled(scrollY > 8);
28
+ check();
29
+ addEventListener("scroll", check, { passive: true });
30
+ return () => removeEventListener("scroll", check);
31
+ }, []);
32
+ return (_jsxs("header", { className: className ? `zjkm-bnav ${className}` : "zjkm-bnav", "data-scrolled": scrolled ? "" : undefined, children: [_jsx("style", { href: "zjkm-blur-navbar", precedence: "default", children: css }), _jsx("span", { className: "zjkm-bnav__brand", children: brand }), _jsx("nav", { "aria-label": "Main", children: _jsx("ul", { children: links.map((l) => (_jsx("li", { children: _jsx("a", { href: l.href, "aria-current": l.href === current ? "page" : undefined, children: l.label }) }, l.href))) }) }), actions && _jsx("div", { className: "zjkm-bnav__actions", children: actions })] }));
33
+ }
@@ -0,0 +1,9 @@
1
+ export interface BotAvatarProps {
2
+ size?: number;
3
+ color?: string;
4
+ mood?: "idle" | "thinking" | "happy";
5
+ label?: string;
6
+ className?: string;
7
+ }
8
+ /** A small bot face that blinks and glances around. */
9
+ export declare function BotAvatar({ size, color, mood, label, className }: BotAvatarProps): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ const css = `
3
+ .zjkm-bot { display: inline-block; vertical-align: middle; flex: none; }
4
+ .zjkm-bot__eye { transform-box: fill-box; transform-origin: center; animation: zjkm-bot-blink 4.5s infinite; }
5
+ .zjkm-bot__eye + .zjkm-bot__eye { animation-delay: 40ms; }
6
+ .zjkm-bot__eyes { animation: zjkm-bot-glance 7s ease-in-out infinite; }
7
+ .zjkm-bot[data-mood="thinking"] .zjkm-bot__eyes { animation: none; transform: translate(2px, -3px); }
8
+ .zjkm-bot[data-mood="thinking"] .zjkm-bot__head { animation: zjkm-bot-bob 2.4s ease-in-out infinite; }
9
+ .zjkm-bot[data-mood="happy"] .zjkm-bot__eye { transform: scaleY(0.55); animation: none; }
10
+ @keyframes zjkm-bot-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
11
+ @keyframes zjkm-bot-glance {
12
+ 0%, 30%, 100% { transform: translateX(0); }
13
+ 40%, 55% { transform: translateX(-2px); }
14
+ 65%, 80% { transform: translateX(2px); }
15
+ }
16
+ @keyframes zjkm-bot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
17
+ @media (prefers-reduced-motion: reduce) { .zjkm-bot * { animation: none !important; } }
18
+ `;
19
+ const mouths = {
20
+ idle: _jsx("path", { d: "M19.5 35h9", stroke: "#fff", strokeWidth: "2.5", strokeLinecap: "round" }),
21
+ thinking: _jsx("circle", { cx: "26", cy: "35", r: "2", fill: "#fff" }),
22
+ happy: _jsx("path", { d: "M18 33q6 5.5 12 0", stroke: "#fff", strokeWidth: "2.5", strokeLinecap: "round", fill: "none" }),
23
+ };
24
+ /** A small bot face that blinks and glances around. */
25
+ export function BotAvatar({ size = 48, color = "#6366f1", mood = "idle", label = "Assistant", className }) {
26
+ return (_jsxs(_Fragment, { children: [_jsx("style", { href: "zjkm-bot-avatars", precedence: "default", children: css }), _jsx("svg", { role: "img", "aria-label": label, width: size, height: size, viewBox: "0 0 48 48", className: className ? `zjkm-bot ${className}` : "zjkm-bot", "data-mood": mood, children: _jsxs("g", { className: "zjkm-bot__head", children: [_jsx("path", { d: "M24 10V5", stroke: color, strokeWidth: "2.5", strokeLinecap: "round" }), _jsx("circle", { cx: "24", cy: "4.5", r: "2.5", fill: color }), _jsx("rect", { x: "6", y: "10", width: "36", height: "32", rx: "12", fill: color }), _jsxs("g", { className: "zjkm-bot__eyes", children: [_jsx("rect", { className: "zjkm-bot__eye", x: "15", y: "21", width: "5", height: "8", rx: "2.5", fill: "#fff" }), _jsx("rect", { className: "zjkm-bot__eye", x: "28", y: "21", width: "5", height: "8", rx: "2.5", fill: "#fff" })] }), mouths[mood]] }) })] }));
27
+ }
@@ -0,0 +1,13 @@
1
+ export interface BubbleSliderProps {
2
+ label: string;
3
+ min?: number;
4
+ max?: number;
5
+ step?: number;
6
+ defaultValue?: number;
7
+ onChange?: (value: number) => void;
8
+ color?: string;
9
+ format?: (value: number) => string;
10
+ className?: string;
11
+ }
12
+ /** A slider with its value in a bubble that rides above the thumb. */
13
+ export declare function BubbleSlider({ label, min, max, step, defaultValue, onChange, color, format, className }: BubbleSliderProps): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ // zjkm Bubble Slider · https://zjkm.tech/docs/components/bubble-slider
2
+ // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useId, useRef, useState } from "react";
6
+ const css = `
7
+ .zjkm-bubble { display: grid; gap: 34px; }
8
+ .zjkm-bubble__track { position: relative; }
9
+ .zjkm-bubble__out {
10
+ position: absolute; bottom: 22px; left: 0; padding: 2px 8px; border-radius: 6px; background: var(--zjkm-range-color); color: #fff;
11
+ font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none;
12
+ /* The thumb's centre runs from 9px to (width - 9px): follow it exactly. */
13
+ transform: translateX(calc(var(--zjkm-bubble-pct) * (var(--zjkm-bubble-w) - 18px) / 100 + 9px - 50%));
14
+ transition: transform 0.08s;
15
+ }
16
+ .zjkm-bubble__out::after { content: ""; position: absolute; left: 50%; top: 100%; border: 5px solid transparent; border-top-color: var(--zjkm-range-color); transform: translateX(-50%); }
17
+ @media (prefers-reduced-motion: reduce) { .zjkm-bubble__out { transition: none; } }
18
+ .zjkm-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--zjkm-range-track); cursor: pointer; }
19
+ .zjkm-range:focus-visible { outline: 2px solid #6366f1; outline-offset: 4px; }
20
+ .zjkm-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--zjkm-range-color); box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
21
+ .zjkm-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--zjkm-range-color); box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); }
22
+ `;
23
+ /** A slider with its value in a bubble that rides above the thumb. */
24
+ export function BubbleSlider({ label, min = 0, max = 100, step = 1, defaultValue = 50, onChange, color = "#4f46e5", format = String, className }) {
25
+ const id = useId();
26
+ const [value, setValue] = useState(defaultValue);
27
+ const [width, setWidth] = useState(0);
28
+ const track = useRef(null);
29
+ useEffect(() => {
30
+ const el = track.current;
31
+ if (!el)
32
+ return;
33
+ setWidth(el.clientWidth);
34
+ if (typeof ResizeObserver === "undefined")
35
+ return;
36
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth));
37
+ ro.observe(el);
38
+ return () => ro.disconnect();
39
+ }, []);
40
+ const pct = ((value - min) / (max - min || 1)) * 100;
41
+ const style = {
42
+ "--zjkm-range-color": color,
43
+ "--zjkm-range-track": `linear-gradient(to right, ${color} ${pct}%, color-mix(in srgb, currentColor 15%, transparent) ${pct}%)`,
44
+ "--zjkm-bubble-pct": pct,
45
+ "--zjkm-bubble-w": `${width}px`,
46
+ };
47
+ return (_jsxs("div", { className: className ? `zjkm-bubble ${className}` : "zjkm-bubble", style: style, children: [_jsx("style", { href: "zjkm-bubble-slider", precedence: "default", children: css }), _jsx("label", { htmlFor: id, children: label }), _jsxs("div", { className: "zjkm-bubble__track", ref: track, children: [_jsx("output", { htmlFor: id, className: "zjkm-bubble__out", children: format(value) }), _jsx("input", { id: id, className: "zjkm-range", type: "range", min: min, max: max, step: step, value: value, "aria-valuetext": format(value), onChange: (e) => {
48
+ setValue(Number(e.target.value));
49
+ onChange?.(Number(e.target.value));
50
+ } })] })] }));
51
+ }
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from "react";
2
+ export interface ChartLinesProps {
3
+ children: ReactNode;
4
+ selector?: string;
5
+ duration?: number;
6
+ stagger?: number;
7
+ className?: string;
8
+ }
9
+ /** Wraps an SVG chart so its lines draw themselves in once it scrolls into view. */
10
+ export declare function ChartLines({ children, selector, duration, stagger, className }: ChartLinesProps): import("react").JSX.Element;
@@ -0,0 +1,71 @@
1
+ // zjkm Chart Lines · https://zjkm.tech/docs/components/chart-lines
2
+ // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { useLayoutEffect, useRef } from "react";
6
+ const reducedMotion = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
7
+ /** Wraps an SVG chart so its lines draw themselves in once it scrolls into view. */
8
+ export function ChartLines({ children, selector = "path", duration = 1.5, stagger = 0.15, className }) {
9
+ const ref = useRef(null);
10
+ // Layout effect: the lines are hidden before the first paint, so they never flash in full first.
11
+ useLayoutEffect(() => {
12
+ const root = ref.current;
13
+ if (!root || reducedMotion())
14
+ return;
15
+ const lines = [...root.querySelectorAll(selector)].filter((l) => typeof l.animate === "function");
16
+ if (!lines.length)
17
+ return;
18
+ // pathLength="1" makes a dash of 1 the whole line, whatever its real length. Put everything back afterwards.
19
+ const saved = lines.map((l) => ({
20
+ pathLength: l.getAttribute("pathLength"),
21
+ dash: l.style.strokeDasharray,
22
+ offset: l.style.strokeDashoffset,
23
+ }));
24
+ const animations = [];
25
+ const restore = () => {
26
+ for (const a of animations)
27
+ a.cancel();
28
+ lines.forEach((l, i) => {
29
+ const { pathLength, dash, offset } = saved[i];
30
+ if (pathLength === null)
31
+ l.removeAttribute("pathLength");
32
+ else
33
+ l.setAttribute("pathLength", pathLength);
34
+ l.style.strokeDasharray = dash;
35
+ l.style.strokeDashoffset = offset;
36
+ });
37
+ };
38
+ // Hidden until it plays: with a dash of 1, an offset of 1 shows none of the line.
39
+ for (const l of lines) {
40
+ l.setAttribute("pathLength", "1");
41
+ l.style.strokeDasharray = "1";
42
+ l.style.strokeDashoffset = "1";
43
+ }
44
+ const play = () => {
45
+ lines.forEach((l, i) => animations.push(l.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], {
46
+ duration: duration * 1000,
47
+ delay: i * stagger * 1000,
48
+ easing: "ease-in-out",
49
+ fill: "both",
50
+ })));
51
+ Promise.all(animations.map((a) => a.finished)).then(restore, () => { });
52
+ };
53
+ const io = typeof IntersectionObserver === "undefined"
54
+ ? null
55
+ : new IntersectionObserver(([entry]) => {
56
+ if (!entry.isIntersecting)
57
+ return;
58
+ io?.disconnect();
59
+ play();
60
+ });
61
+ if (io)
62
+ io.observe(root);
63
+ else
64
+ play();
65
+ return () => {
66
+ io?.disconnect();
67
+ restore();
68
+ };
69
+ }, [selector, duration, stagger]);
70
+ return (_jsx("div", { ref: ref, className: className, children: children }));
71
+ }
@@ -0,0 +1,9 @@
1
+ export interface ChipSelectProps {
2
+ label: string;
3
+ options: string[];
4
+ defaultValue?: string[];
5
+ onChange?: (value: string[]) => void;
6
+ className?: string;
7
+ }
8
+ /** Pick several options as chips. Each chip is a real checkbox, so Tab and Space work as usual. */
9
+ export declare function ChipSelect({ label, options, defaultValue, onChange, className }: ChipSelectProps): import("react").JSX.Element;