zjkm-ui 0.1.0 → 0.1.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 (155) hide show
  1. package/README.md +3 -3
  2. package/dist/accordion/accordion.js +14 -14
  3. package/dist/alert-dialog/alert-dialog.js +25 -25
  4. package/dist/animated-checkbox/animated-checkbox.js +11 -11
  5. package/dist/auto-hide-navbar/auto-hide-navbar.js +2 -2
  6. package/dist/avatar-tooltip/avatar-tooltip.js +19 -19
  7. package/dist/back-to-top/back-to-top.d.ts +11 -0
  8. package/dist/back-to-top/back-to-top.js +55 -0
  9. package/dist/blur-navbar/blur-navbar.js +2 -2
  10. package/dist/bubble-slider/bubble-slider.js +18 -18
  11. package/dist/chart-lines/chart-lines.js +2 -2
  12. package/dist/chip-select/chip-select.js +14 -14
  13. package/dist/citation-chips/citation-chips.js +21 -21
  14. package/dist/clip-reveal/clip-reveal.d.ts +9 -0
  15. package/dist/clip-reveal/clip-reveal.js +53 -0
  16. package/dist/collapsible-sidebar/collapsible-sidebar.js +19 -19
  17. package/dist/color-shift/color-shift.d.ts +12 -0
  18. package/dist/color-shift/color-shift.js +56 -0
  19. package/dist/count-up/count-up.js +2 -2
  20. package/dist/cursor-spotlight/cursor-spotlight.js +2 -2
  21. package/dist/cursor-tooltip/cursor-tooltip.js +13 -13
  22. package/dist/dock/dock.js +20 -20
  23. package/dist/dot-grid/dot-grid.js +2 -2
  24. package/dist/dot-pagination/dot-pagination.js +11 -11
  25. package/dist/dots-scrollbar/dots-scrollbar.d.ts +13 -0
  26. package/dist/dots-scrollbar/dots-scrollbar.js +64 -0
  27. package/dist/drawer-sidebar/drawer-sidebar.js +22 -22
  28. package/dist/dual-range-slider/dual-range-slider.js +15 -15
  29. package/dist/elastic-scrollbar/elastic-scrollbar.d.ts +13 -0
  30. package/dist/elastic-scrollbar/elastic-scrollbar.js +108 -0
  31. package/dist/exclusive-accordion/exclusive-accordion.js +17 -17
  32. package/dist/fill-scrollbar/fill-scrollbar.d.ts +14 -0
  33. package/dist/fill-scrollbar/fill-scrollbar.js +75 -0
  34. package/dist/film-grain/film-grain.js +15 -15
  35. package/dist/floating-label-input/floating-label-input.js +2 -2
  36. package/dist/glass-scrollbar/glass-scrollbar.d.ts +14 -0
  37. package/dist/glass-scrollbar/glass-scrollbar.js +23 -0
  38. package/dist/glow-button/glow-button.js +2 -2
  39. package/dist/gradient-scrollbar/gradient-scrollbar.d.ts +15 -0
  40. package/dist/gradient-scrollbar/gradient-scrollbar.js +21 -0
  41. package/dist/gradient-slider/gradient-slider.js +2 -2
  42. package/dist/halftone-image/halftone-image.js +2 -2
  43. package/dist/hamburger-navbar/hamburger-navbar.js +2 -2
  44. package/dist/hold-to-confirm/hold-to-confirm.js +12 -12
  45. package/dist/horizontal-accordion/horizontal-accordion.js +2 -2
  46. package/dist/horizontal-scroll/horizontal-scroll.d.ts +11 -0
  47. package/dist/horizontal-scroll/horizontal-scroll.js +70 -0
  48. package/dist/hover-reveal-scrollbar/hover-reveal-scrollbar.d.ts +14 -0
  49. package/dist/hover-reveal-scrollbar/hover-reveal-scrollbar.js +24 -0
  50. package/dist/icon-toggle/icon-toggle.js +13 -13
  51. package/dist/indicator-sidebar/indicator-sidebar.js +14 -14
  52. package/dist/infinite-scroll/infinite-scroll.d.ts +15 -0
  53. package/dist/infinite-scroll/infinite-scroll.js +45 -0
  54. package/dist/inset-scrollbar/inset-scrollbar.d.ts +14 -0
  55. package/dist/inset-scrollbar/inset-scrollbar.js +26 -0
  56. package/dist/liquid-shapes/liquid-shapes.js +2 -2
  57. package/dist/loading-button/loading-button.js +22 -22
  58. package/dist/magnetic-button/magnetic-button.js +8 -8
  59. package/dist/marquee/marquee.d.ts +16 -0
  60. package/dist/marquee/marquee.js +33 -0
  61. package/dist/minimap-scrollbar/minimap-scrollbar.d.ts +14 -0
  62. package/dist/minimap-scrollbar/minimap-scrollbar.js +79 -0
  63. package/dist/neon-scrollbar/neon-scrollbar.d.ts +14 -0
  64. package/dist/neon-scrollbar/neon-scrollbar.js +23 -0
  65. package/dist/nested-sidebar/nested-sidebar.js +20 -20
  66. package/dist/one-question-form/one-question-form.js +18 -18
  67. package/dist/otp-input/otp-input.js +2 -2
  68. package/dist/outline-scrollbar/outline-scrollbar.d.ts +14 -0
  69. package/dist/outline-scrollbar/outline-scrollbar.js +20 -0
  70. package/dist/overlay-scrollbar/overlay-scrollbar.d.ts +14 -0
  71. package/dist/overlay-scrollbar/overlay-scrollbar.js +91 -0
  72. package/dist/page-jump/page-jump.js +18 -18
  73. package/dist/pagination/pagination.js +11 -11
  74. package/dist/parallax-layers/parallax-layers.d.ts +11 -0
  75. package/dist/parallax-layers/parallax-layers.js +55 -0
  76. package/dist/password-input/password-input.js +2 -2
  77. package/dist/percent-scrollbar/percent-scrollbar.d.ts +10 -0
  78. package/dist/percent-scrollbar/percent-scrollbar.js +95 -0
  79. package/dist/pill-navbar/pill-navbar.js +14 -14
  80. package/dist/pill-scrollbar/pill-scrollbar.d.ts +14 -0
  81. package/dist/pill-scrollbar/pill-scrollbar.js +20 -0
  82. package/dist/pixel-mosaic/pixel-mosaic-plain.js +2 -2
  83. package/dist/pixel-mosaic/pixel-mosaic-plain.module.css +13 -13
  84. package/dist/pixel-mosaic/pixel-mosaic.js +2 -2
  85. package/dist/pixel-mosaic/use-pixel-mosaic.js +2 -2
  86. package/dist/poll/poll.js +2 -2
  87. package/dist/promise-toast/promise-toast.js +23 -23
  88. package/dist/questionnaire/questionnaire.js +2 -2
  89. package/dist/quiz/quiz.js +2 -2
  90. package/dist/radio-cards/radio-cards.js +16 -16
  91. package/dist/radio-list/radio-list.js +15 -15
  92. package/dist/rail-scrollbar/rail-scrollbar.d.ts +15 -0
  93. package/dist/rail-scrollbar/rail-scrollbar.js +23 -0
  94. package/dist/range-slider/range-slider.js +2 -2
  95. package/dist/rating-scale/rating-scale.js +2 -2
  96. package/dist/read-more/read-more.js +8 -8
  97. package/dist/resizable-sidebar/resizable-sidebar.js +2 -2
  98. package/dist/retro-scrollbar/retro-scrollbar.d.ts +13 -0
  99. package/dist/retro-scrollbar/retro-scrollbar.js +29 -0
  100. package/dist/rich-select/rich-select.js +19 -19
  101. package/dist/rich-tooltip/rich-tooltip.js +18 -18
  102. package/dist/ripple-button/ripple-button.js +15 -15
  103. package/dist/scramble-text/scramble-text.js +2 -2
  104. package/dist/scroll-fade/scroll-fade.d.ts +10 -0
  105. package/dist/scroll-fade/scroll-fade.js +35 -0
  106. package/dist/scroll-progress/scroll-progress.d.ts +8 -0
  107. package/dist/scroll-progress/scroll-progress.js +49 -0
  108. package/dist/scroll-reveal/scroll-reveal.d.ts +15 -0
  109. package/dist/scroll-reveal/scroll-reveal.js +52 -0
  110. package/dist/scroll-spy/scroll-spy.d.ts +13 -0
  111. package/dist/scroll-spy/scroll-spy.js +61 -0
  112. package/dist/scroll-text-reveal/scroll-text-reveal.d.ts +7 -0
  113. package/dist/scroll-text-reveal/scroll-text-reveal.js +53 -0
  114. package/dist/scroll-timeline/scroll-timeline.d.ts +13 -0
  115. package/dist/scroll-timeline/scroll-timeline.js +63 -0
  116. package/dist/scroll-zoom/scroll-zoom.d.ts +9 -0
  117. package/dist/scroll-zoom/scroll-zoom.js +54 -0
  118. package/dist/search-input/search-input.js +18 -18
  119. package/dist/searchable-select/searchable-select.js +2 -2
  120. package/dist/section-scrollbar/section-scrollbar.d.ts +13 -0
  121. package/dist/section-scrollbar/section-scrollbar.js +78 -0
  122. package/dist/segmented-control/segmented-control.js +17 -17
  123. package/dist/sheet-dialog/sheet-dialog.js +17 -17
  124. package/dist/shimmer-button/shimmer-button.js +15 -15
  125. package/dist/shortcut-tooltip/shortcut-tooltip.js +17 -17
  126. package/dist/simple-pagination/simple-pagination.js +12 -12
  127. package/dist/snap-carousel/snap-carousel.d.ts +8 -0
  128. package/dist/snap-carousel/snap-carousel.js +74 -0
  129. package/dist/star-rating/star-rating.js +12 -12
  130. package/dist/step-progress/step-progress.js +14 -14
  131. package/dist/stepped-slider/stepped-slider.js +10 -10
  132. package/dist/sticky-stack/sticky-stack.d.ts +9 -0
  133. package/dist/sticky-stack/sticky-stack.js +50 -0
  134. package/dist/striped-scrollbar/striped-scrollbar.d.ts +14 -0
  135. package/dist/striped-scrollbar/striped-scrollbar.js +22 -0
  136. package/dist/styled-select/styled-select.js +44 -13
  137. package/dist/swatch-picker/swatch-picker.js +16 -16
  138. package/dist/swipe-toast/swipe-toast.js +21 -21
  139. package/dist/switch/switch.js +17 -17
  140. package/dist/tag-input/tag-input.js +20 -20
  141. package/dist/terminal-scrollbar/terminal-scrollbar.d.ts +14 -0
  142. package/dist/terminal-scrollbar/terminal-scrollbar.js +23 -0
  143. package/dist/theme-toggle/theme-toggle.js +14 -14
  144. package/dist/thin-scrollbar/thin-scrollbar.d.ts +14 -0
  145. package/dist/thin-scrollbar/thin-scrollbar.js +19 -0
  146. package/dist/timed-toast/timed-toast.js +26 -26
  147. package/dist/toaster/toaster.js +26 -26
  148. package/dist/toggle-group/toggle-group.js +2 -2
  149. package/dist/tooltip/tooltip.js +15 -15
  150. package/dist/type-to-confirm-dialog/type-to-confirm-dialog.js +29 -29
  151. package/dist/undo-toast/undo-toast.js +18 -18
  152. package/dist/velocity-skew/velocity-skew.d.ts +9 -0
  153. package/dist/velocity-skew/velocity-skew.js +47 -0
  154. package/dist/zoom-dialog/zoom-dialog.js +31 -31
  155. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # zjkm-ui
2
2
 
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)**.
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 **[ui.zjkm.tech](https://ui.zjkm.tech)**.
4
4
 
5
5
  ```sh
6
6
  npm install zjkm-ui
@@ -22,7 +22,7 @@ export function Cta() {
22
22
  }
23
23
  ```
24
24
 
25
- The path is the component's name in kebab case, the same as its docs URL: `zjkm.tech/docs/components/<name>`.
25
+ The path is the component's name in kebab case, the same as its docs URL: `ui.zjkm.tech/docs/components/<name>`.
26
26
 
27
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
28
 
@@ -32,4 +32,4 @@ Prefer to own the code? Every component can also be copied into your project wit
32
32
 
33
33
  ## License
34
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).
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 [ui.zjkm.tech/license](https://ui.zjkm.tech/license).
@@ -1,18 +1,18 @@
1
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; } }
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
16
  `;
17
17
  /** Sections that open and close smoothly. Native <details>, so it works without JavaScript and find-in-page opens it. */
18
18
  export function Accordion({ items, defaultOpen = [], className }) {
@@ -1,31 +1,31 @@
1
- // zjkm Alert Dialog · https://zjkm.tech/docs/components/alert-dialog
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Alert Dialog · https://ui.zjkm.tech/docs/components/alert-dialog
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
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; } }
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
29
  `;
30
30
  function useModal(open) {
31
31
  const ref = useRef(null);
@@ -1,15 +1,15 @@
1
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; } }
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
13
  `;
14
14
  /** A native checkbox drawn as a box whose tick draws itself when checked. */
15
15
  export function AnimatedCheckbox({ children, color = "#6366f1", className, style, ...props }) {
@@ -1,5 +1,5 @@
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
1
+ // zjkm Auto-hide Navbar · https://ui.zjkm.tech/docs/components/auto-hide-navbar
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useEffect, useState } from "react";
@@ -1,23 +1,23 @@
1
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; } }
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
21
  `;
22
22
  const initials = (name) => name.split(/\s+/).map((w) => w[0]).slice(0, 2).join("").toUpperCase();
23
23
  /** Overlapping avatars with each name shown on hover, and "+N" for the rest. Every avatar is named for screen readers. */
@@ -0,0 +1,11 @@
1
+ export interface BackToTopProps {
2
+ threshold?: number;
3
+ label?: string;
4
+ contained?: boolean;
5
+ className?: string;
6
+ }
7
+ /**
8
+ * A round button that appears once you've scrolled down and takes you back to the top.
9
+ * It stays reachable by keyboard and shows itself whenever it has focus.
10
+ */
11
+ export declare function BackToTop({ threshold, label, contained, className }: BackToTopProps): import("react").JSX.Element;
@@ -0,0 +1,55 @@
1
+ // zjkm Back to Top · https://ui.zjkm.tech/docs/components/back-to-top
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useRef, useState } from "react";
6
+ const css = `
7
+ .zjkm-totop {
8
+ position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-grid; place-items: center; width: 44px; height: 44px;
9
+ padding: 0; border: 1px solid color-mix(in srgb, CanvasText 12%, transparent); border-radius: 50%; cursor: pointer;
10
+ background: Canvas; color: CanvasText; box-shadow: 0 8px 24px -8px rgb(0 0 0 / 0.35);
11
+ transition: opacity 0.2s ease-out, translate 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s;
12
+ }
13
+ .zjkm-totop[data-contained] { position: sticky; bottom: 16px; margin: 0 16px 0 auto; display: grid; }
14
+ .zjkm-totop:not([data-show]):not(:focus-visible) { opacity: 0; translate: 0 12px; pointer-events: none; }
15
+ .zjkm-totop:hover { background: color-mix(in srgb, CanvasText 6%, Canvas); }
16
+ .zjkm-totop:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
17
+ .zjkm-totop svg { width: 20px; height: 20px; }
18
+ @media (prefers-reduced-motion: reduce) { .zjkm-totop { transition: none; } }
19
+ `;
20
+ const reducedMotion = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
21
+ // The nearest scrolling ancestor, or null for the page.
22
+ function scrollerOf(el) {
23
+ for (let p = el.parentElement; p; p = p.parentElement) {
24
+ const { overflowY } = getComputedStyle(p);
25
+ if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight)
26
+ return p;
27
+ }
28
+ return null;
29
+ }
30
+ /**
31
+ * A round button that appears once you've scrolled down and takes you back to the top.
32
+ * It stays reachable by keyboard and shows itself whenever it has focus.
33
+ */
34
+ export function BackToTop({ threshold = 400, label = "Back to top", contained = false, className }) {
35
+ const ref = useRef(null);
36
+ const [show, setShow] = useState(false);
37
+ useEffect(() => {
38
+ const el = ref.current;
39
+ if (!el)
40
+ return;
41
+ const read = () => {
42
+ const s = contained ? scrollerOf(el) : null;
43
+ setShow((s ? s.scrollTop : scrollY) > threshold);
44
+ };
45
+ read();
46
+ document.addEventListener("scroll", read, { capture: true, passive: true });
47
+ return () => document.removeEventListener("scroll", read, { capture: true });
48
+ }, [threshold, contained]);
49
+ const toTop = () => {
50
+ const el = ref.current;
51
+ const s = el && contained ? scrollerOf(el) : null;
52
+ (s ?? window).scrollTo({ top: 0, behavior: reducedMotion() ? "auto" : "smooth" });
53
+ };
54
+ return (_jsxs("button", { ref: ref, type: "button", "aria-label": label, onClick: toTop, className: className ? `zjkm-totop ${className}` : "zjkm-totop", "data-show": show ? "" : undefined, "data-contained": contained ? "" : undefined, children: [_jsx("style", { href: "zjkm-back-to-top", precedence: "default", children: css }), _jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M18 15C18 15 13.5811 9 12 9C10.4188 9 6 15 6 15" }) })] }));
55
+ }
@@ -1,5 +1,5 @@
1
- // zjkm Blur Navbar · https://zjkm.tech/docs/components/blur-navbar
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Blur Navbar · https://ui.zjkm.tech/docs/components/blur-navbar
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useEffect, useState } from "react";
@@ -1,24 +1,24 @@
1
- // zjkm Bubble Slider · https://zjkm.tech/docs/components/bubble-slider
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Bubble Slider · https://ui.zjkm.tech/docs/components/bubble-slider
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
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); }
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
22
  `;
23
23
  /** A slider with its value in a bubble that rides above the thumb. */
24
24
  export function BubbleSlider({ label, min = 0, max = 100, step = 1, defaultValue = 50, onChange, color = "#4f46e5", format = String, className }) {
@@ -1,5 +1,5 @@
1
- // zjkm Chart Lines · https://zjkm.tech/docs/components/chart-lines
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Chart Lines · https://ui.zjkm.tech/docs/components/chart-lines
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { useLayoutEffect, useRef } from "react";
@@ -1,20 +1,20 @@
1
- // zjkm Chip Select · https://zjkm.tech/docs/components/chip-select
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Chip Select · https://ui.zjkm.tech/docs/components/chip-select
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useId, useState } from "react";
6
- const css = `
7
- .zjkm-chipsel { display: grid; gap: 8px; }
8
- .zjkm-chipsel__list { display: flex; flex-wrap: wrap; gap: 8px; }
9
- .zjkm-chipsel__list label {
10
- display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 14px;
11
- border: 1px solid color-mix(in srgb, currentColor 25%, transparent); transition: background 0.15s, border-color 0.15s;
12
- }
13
- .zjkm-chipsel__list input { position: absolute; opacity: 0; width: 1px; height: 1px; }
14
- .zjkm-chipsel__list label:has(:checked) { background: #4f46e5; border-color: #4f46e5; color: #fff; }
15
- .zjkm-chipsel__list label:has(:focus-visible) { outline: 2px solid #6366f1; outline-offset: 2px; }
16
- .zjkm-chipsel__tick { display: none; }
17
- .zjkm-chipsel__list label:has(:checked) .zjkm-chipsel__tick { display: inline; }
6
+ const css = `
7
+ .zjkm-chipsel { display: grid; gap: 8px; }
8
+ .zjkm-chipsel__list { display: flex; flex-wrap: wrap; gap: 8px; }
9
+ .zjkm-chipsel__list label {
10
+ display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 14px;
11
+ border: 1px solid color-mix(in srgb, currentColor 25%, transparent); transition: background 0.15s, border-color 0.15s;
12
+ }
13
+ .zjkm-chipsel__list input { position: absolute; opacity: 0; width: 1px; height: 1px; }
14
+ .zjkm-chipsel__list label:has(:checked) { background: #4f46e5; border-color: #4f46e5; color: #fff; }
15
+ .zjkm-chipsel__list label:has(:focus-visible) { outline: 2px solid #6366f1; outline-offset: 2px; }
16
+ .zjkm-chipsel__tick { display: none; }
17
+ .zjkm-chipsel__list label:has(:checked) .zjkm-chipsel__tick { display: inline; }
18
18
  `;
19
19
  /** Pick several options as chips. Each chip is a real checkbox, so Tab and Space work as usual. */
20
20
  export function ChipSelect({ label, options, defaultValue = [], onChange, className }) {
@@ -1,27 +1,27 @@
1
- // zjkm Citation Chips · https://zjkm.tech/docs/components/citation-chips
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Citation Chips · https://ui.zjkm.tech/docs/components/citation-chips
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useLayoutEffect, useRef } from "react";
6
- const css = `
7
- .zjkm-chips { position: relative; display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
8
- .zjkm-chips > li { transform: translateX(var(--zjkm-chip-x, 0)); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
9
- .zjkm-chips:hover > li, .zjkm-chips:focus-within > li { transform: none; }
10
- /* Collapsed, each chip shows only its number badge; the labels stay in the accessibility tree. */
11
- .zjkm-chips .zjkm-chip { clip-path: inset(0 calc(100% - 24px) 0 0 round 999px); transition: clip-path 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
12
- .zjkm-chips:hover .zjkm-chip, .zjkm-chips:focus-within .zjkm-chip { clip-path: inset(0 round 999px); }
13
- .zjkm-chip {
14
- display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px;
15
- border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 999px;
16
- background: var(--zjkm-chip-bg, Canvas); color: inherit; font-size: 12px; line-height: 20px;
17
- text-decoration: none; white-space: nowrap; box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
18
- }
19
- .zjkm-chip:hover { border-color: color-mix(in srgb, currentColor 40%, transparent); }
20
- .zjkm-chip__n {
21
- display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
22
- background: color-mix(in srgb, currentColor 12%, transparent); font-size: 11px; font-weight: 600;
23
- }
24
- @media (prefers-reduced-motion: reduce) { .zjkm-chips > li, .zjkm-chips .zjkm-chip { transition: none; } }
6
+ const css = `
7
+ .zjkm-chips { position: relative; display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
8
+ .zjkm-chips > li { transform: translateX(var(--zjkm-chip-x, 0)); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
9
+ .zjkm-chips:hover > li, .zjkm-chips:focus-within > li { transform: none; }
10
+ /* Collapsed, each chip shows only its number badge; the labels stay in the accessibility tree. */
11
+ .zjkm-chips .zjkm-chip { clip-path: inset(0 calc(100% - 24px) 0 0 round 999px); transition: clip-path 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
12
+ .zjkm-chips:hover .zjkm-chip, .zjkm-chips:focus-within .zjkm-chip { clip-path: inset(0 round 999px); }
13
+ .zjkm-chip {
14
+ display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px;
15
+ border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 999px;
16
+ background: var(--zjkm-chip-bg, Canvas); color: inherit; font-size: 12px; line-height: 20px;
17
+ text-decoration: none; white-space: nowrap; box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
18
+ }
19
+ .zjkm-chip:hover { border-color: color-mix(in srgb, currentColor 40%, transparent); }
20
+ .zjkm-chip__n {
21
+ display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
22
+ background: color-mix(in srgb, currentColor 12%, transparent); font-size: 11px; font-weight: 600;
23
+ }
24
+ @media (prefers-reduced-motion: reduce) { .zjkm-chips > li, .zjkm-chips .zjkm-chip { transition: none; } }
25
25
  `;
26
26
  /** Numbered source badges, stacked, that fan out into labelled chips on hover or keyboard focus. */
27
27
  export function CitationChips({ items, overlap = 14, className }) {
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from "react";
2
+ export interface ClipRevealProps {
3
+ children: ReactNode;
4
+ inset?: number;
5
+ radius?: number;
6
+ className?: string;
7
+ }
8
+ /** Opens from a small window in the middle to the full image as it scrolls up into view. */
9
+ export declare function ClipReveal({ children, inset, radius, className }: ClipRevealProps): import("react").JSX.Element;
@@ -0,0 +1,53 @@
1
+ // zjkm Clip Reveal · https://ui.zjkm.tech/docs/components/clip-reveal
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useRef } from "react";
6
+ const css = `
7
+ .zjkm-clip > div { will-change: clip-path; }
8
+ .zjkm-clip > div > :is(img, video) { display: block; width: 100%; height: auto; }
9
+ @media (prefers-reduced-motion: reduce) { .zjkm-clip > div { clip-path: none !important; } }
10
+ `;
11
+ const reducedMotion = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
12
+ // The visible box of the nearest scrolling ancestor, or of the window.
13
+ function viewportOf(el) {
14
+ for (let p = el.parentElement; p; p = p.parentElement) {
15
+ const { overflowY } = getComputedStyle(p);
16
+ if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight) {
17
+ return { top: p.getBoundingClientRect().top + p.clientTop, height: p.clientHeight };
18
+ }
19
+ }
20
+ return { top: 0, height: innerHeight };
21
+ }
22
+ /** Opens from a small window in the middle to the full image as it scrolls up into view. */
23
+ export function ClipReveal({ children, inset = 30, radius = 16, className }) {
24
+ const outer = useRef(null);
25
+ const inner = useRef(null);
26
+ useEffect(() => {
27
+ const o = outer.current;
28
+ const i = inner.current;
29
+ if (!o || !i || reducedMotion())
30
+ return;
31
+ let raf = 0;
32
+ const update = () => {
33
+ const vp = viewportOf(o);
34
+ // 0 as the top enters the bottom edge, 1 once it's two thirds of the way up.
35
+ const p = Math.min(1, Math.max(0, (vp.top + vp.height - o.getBoundingClientRect().top) / (vp.height * 0.66)));
36
+ const left = inset * (1 - (1 - (1 - p) ** 3));
37
+ i.style.clipPath = `inset(${(left * 0.6).toFixed(2)}% ${left.toFixed(2)}% round ${radius}px)`;
38
+ };
39
+ const run = () => {
40
+ cancelAnimationFrame(raf);
41
+ raf = requestAnimationFrame(update);
42
+ };
43
+ update();
44
+ document.addEventListener("scroll", run, { capture: true, passive: true });
45
+ addEventListener("resize", run);
46
+ return () => {
47
+ cancelAnimationFrame(raf);
48
+ document.removeEventListener("scroll", run, { capture: true });
49
+ removeEventListener("resize", run);
50
+ };
51
+ }, [inset, radius]);
52
+ return (_jsxs("div", { ref: outer, className: className ? `zjkm-clip ${className}` : "zjkm-clip", children: [_jsx("style", { href: "zjkm-clip-reveal", precedence: "default", children: css }), _jsx("div", { ref: inner, children: children })] }));
53
+ }
@@ -1,25 +1,25 @@
1
- // zjkm Collapsible Sidebar · https://zjkm.tech/docs/components/collapsible-sidebar
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Collapsible Sidebar · https://ui.zjkm.tech/docs/components/collapsible-sidebar
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useState } from "react";
6
- const css = `
7
- .zjkm-csb { display: flex; flex-direction: column; gap: 4px; width: 220px; padding: 8px; transition: width 0.2s ease-out; overflow: hidden;
8
- border-right: 1px solid color-mix(in srgb, currentColor 12%, transparent); }
9
- .zjkm-csb[data-collapsed] { width: 56px; }
10
- .zjkm-csb a, .zjkm-csb > button {
11
- display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; white-space: nowrap;
12
- background: transparent; color: inherit; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer;
13
- }
14
- .zjkm-csb a:hover, .zjkm-csb > button:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
15
- .zjkm-csb a[aria-current="page"] { background: color-mix(in srgb, #6366f1 18%, transparent); font-weight: 600; }
16
- .zjkm-csb a:focus-visible, .zjkm-csb > button:focus-visible { outline: 2px solid #6366f1; outline-offset: -2px; }
17
- .zjkm-csb__icon { display: inline-grid; place-items: center; width: 18px; flex: none; }
18
- .zjkm-csb ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
19
- /* Collapsed, labels leave the screen but stay as the links' names. */
20
- .zjkm-csb[data-collapsed] .zjkm-csb__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
21
- .zjkm-csb > button { margin-top: auto; opacity: 0.75; }
22
- @media (prefers-reduced-motion: reduce) { .zjkm-csb { transition: none; } }
6
+ const css = `
7
+ .zjkm-csb { display: flex; flex-direction: column; gap: 4px; width: 220px; padding: 8px; transition: width 0.2s ease-out; overflow: hidden;
8
+ border-right: 1px solid color-mix(in srgb, currentColor 12%, transparent); }
9
+ .zjkm-csb[data-collapsed] { width: 56px; }
10
+ .zjkm-csb a, .zjkm-csb > button {
11
+ display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border: 0; border-radius: 8px; white-space: nowrap;
12
+ background: transparent; color: inherit; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer;
13
+ }
14
+ .zjkm-csb a:hover, .zjkm-csb > button:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
15
+ .zjkm-csb a[aria-current="page"] { background: color-mix(in srgb, #6366f1 18%, transparent); font-weight: 600; }
16
+ .zjkm-csb a:focus-visible, .zjkm-csb > button:focus-visible { outline: 2px solid #6366f1; outline-offset: -2px; }
17
+ .zjkm-csb__icon { display: inline-grid; place-items: center; width: 18px; flex: none; }
18
+ .zjkm-csb ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
19
+ /* Collapsed, labels leave the screen but stay as the links' names. */
20
+ .zjkm-csb[data-collapsed] .zjkm-csb__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
21
+ .zjkm-csb > button { margin-top: auto; opacity: 0.75; }
22
+ @media (prefers-reduced-motion: reduce) { .zjkm-csb { transition: none; } }
23
23
  `;
24
24
  /** A sidebar that collapses to icons. Collapsed, the labels stay as the links' accessible names. */
25
25
  export function CollapsibleSidebar({ items, current, label = "Main", defaultCollapsed = false, className }) {
@@ -0,0 +1,12 @@
1
+ import { type ReactNode } from "react";
2
+ export interface ColorShiftSection {
3
+ background: string;
4
+ color?: string;
5
+ content: ReactNode;
6
+ }
7
+ export interface ColorShiftProps {
8
+ sections: ColorShiftSection[];
9
+ className?: string;
10
+ }
11
+ /** Sections that share one background, which changes to each section's colour as it reaches the middle of the view. */
12
+ export declare function ColorShift({ sections, className }: ColorShiftProps): import("react").JSX.Element;
@@ -0,0 +1,56 @@
1
+ // zjkm Color Shift · https://ui.zjkm.tech/docs/components/color-shift
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
+ "use client";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useRef, useState } from "react";
6
+ const css = `
7
+ .zjkm-cshift { background: var(--zjkm-cshift-bg); color: var(--zjkm-cshift-fg, inherit); transition: background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1), color 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
8
+ .zjkm-cshift > section { min-height: 70vh; display: grid; align-content: center; padding: 48px 24px; }
9
+ @media (prefers-reduced-motion: reduce) { .zjkm-cshift { transition: none; } }
10
+ `;
11
+ // The visible box of the nearest scrolling ancestor, or of the window.
12
+ function viewportOf(el) {
13
+ for (let p = el.parentElement; p; p = p.parentElement) {
14
+ const { overflowY } = getComputedStyle(p);
15
+ if ((overflowY === "auto" || overflowY === "scroll") && p.scrollHeight > p.clientHeight) {
16
+ return { top: p.getBoundingClientRect().top + p.clientTop, height: p.clientHeight };
17
+ }
18
+ }
19
+ return { top: 0, height: innerHeight };
20
+ }
21
+ /** Sections that share one background, which changes to each section's colour as it reaches the middle of the view. */
22
+ export function ColorShift({ sections, className }) {
23
+ const ref = useRef(null);
24
+ const [active, setActive] = useState(0);
25
+ useEffect(() => {
26
+ const el = ref.current;
27
+ if (!el)
28
+ return;
29
+ let raf = 0;
30
+ const update = () => {
31
+ const vp = viewportOf(el);
32
+ const mid = vp.top + vp.height / 2;
33
+ let current = 0;
34
+ [...el.children].filter((c) => c.tagName === "SECTION").forEach((s, i) => {
35
+ if (s.getBoundingClientRect().top <= mid)
36
+ current = i;
37
+ });
38
+ setActive(current);
39
+ };
40
+ const run = () => {
41
+ cancelAnimationFrame(raf);
42
+ raf = requestAnimationFrame(update);
43
+ };
44
+ update();
45
+ document.addEventListener("scroll", run, { capture: true, passive: true });
46
+ addEventListener("resize", run);
47
+ return () => {
48
+ cancelAnimationFrame(raf);
49
+ document.removeEventListener("scroll", run, { capture: true });
50
+ removeEventListener("resize", run);
51
+ };
52
+ }, [sections.length]);
53
+ const s = sections[active] ?? sections[0];
54
+ const style = { "--zjkm-cshift-bg": s?.background, "--zjkm-cshift-fg": s?.color };
55
+ return (_jsxs("div", { ref: ref, className: className ? `zjkm-cshift ${className}` : "zjkm-cshift", style: style, children: [_jsx("style", { href: "zjkm-color-shift", precedence: "default", children: css }), sections.map((section, i) => (_jsx("section", { children: section.content }, i)))] }));
56
+ }
@@ -1,5 +1,5 @@
1
- // zjkm Count Up · https://zjkm.tech/docs/components/count-up
2
- // MIT + Commons Clause (source-available, no resale) · https://zjkm.tech/license
1
+ // zjkm Count Up · https://ui.zjkm.tech/docs/components/count-up
2
+ // MIT + Commons Clause (source-available, no resale) · https://ui.zjkm.tech/license
3
3
  "use client";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { useEffect, useRef } from "react";