boltdocs 2.7.9 → 2.7.11

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 (174) hide show
  1. package/dist/{cache-DorPMFgW.cjs → cache-Ba-DZQNH.cjs} +1 -1
  2. package/dist/{cache-CQKlT4fI.mjs → cache-BuMZ58L5.mjs} +1 -1
  3. package/dist/chunk-CU-zTemE.cjs +6 -0
  4. package/dist/client/index.cjs +1929 -1
  5. package/dist/client/index.js +1880 -1
  6. package/dist/client/mdx.cjs +7 -1
  7. package/dist/client/mdx.js +7 -1
  8. package/dist/client/primitives.cjs +60 -1
  9. package/dist/client/primitives.js +20 -1
  10. package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
  11. package/dist/docs-layout-DwFndmj5.js +1231 -0
  12. package/dist/doctor-Be7Ly1oM.mjs +21 -0
  13. package/dist/{doctor-D4_Y7M4p.cjs → doctor-CrytFkqW.cjs} +1 -1
  14. package/dist/doctor-jMxWZyLJ.cjs +21 -0
  15. package/dist/generator-CHqxiQhF.cjs +21 -0
  16. package/dist/generator-ClVanhvi.mjs +21 -0
  17. package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
  18. package/dist/icons-dev-Df8OQ481.js +839 -0
  19. package/dist/image-DtrI2cw3.cjs +268 -0
  20. package/dist/image-jxPb-2iV.js +214 -0
  21. package/dist/mdx-BdWkJTeB.cjs +523 -0
  22. package/dist/mdx-UTTLFWJq.js +494 -0
  23. package/dist/meta-loader-CWg2gnbY.mjs +6 -0
  24. package/dist/meta-loader-Cv9O0Pzl.cjs +6 -0
  25. package/dist/node/cli-entry.cjs +1 -1
  26. package/dist/node/cli-entry.mjs +1 -1
  27. package/dist/node/index.cjs +1 -1
  28. package/dist/node/index.mjs +1 -1
  29. package/dist/node/routes/worker.cjs +1 -1
  30. package/dist/node/routes/worker.mjs +1 -1
  31. package/dist/node-BSM4qcDK.cjs +111 -0
  32. package/dist/node-BspZN3R2.mjs +111 -0
  33. package/dist/{package-VfQM94VL.cjs → package-DIIrjuWI.cjs} +1 -1
  34. package/dist/{package-B4MD00N3.mjs → package-K0zsjGIz.mjs} +1 -1
  35. package/dist/{parser-Bh11BsdA.cjs → parser-Aq8LoH-0.cjs} +1 -1
  36. package/dist/{parser-DYRzXWmA.cjs → parser-CdNbqN5y.cjs} +1 -1
  37. package/dist/parser-nE792MLO.mjs +6 -0
  38. package/dist/rolldown-runtime-fkIsjY3S.mjs +6 -0
  39. package/dist/{routes-Co1mRM58.cjs → routes-2k3tbUmC.cjs} +1 -1
  40. package/dist/routes-CpxZIsMM.mjs +6 -0
  41. package/dist/{routes-CHf76Ye4.cjs → routes-DP1vmWRj.cjs} +1 -1
  42. package/dist/search-dialog-BHuIiUC6.js +8 -0
  43. package/dist/search-dialog-BNF10tDl.js +375 -0
  44. package/dist/search-dialog-BwkDuI9R.cjs +220 -0
  45. package/dist/search-dialog-C7xuvyNk.cjs +386 -0
  46. package/dist/search-dialog-CIQg6k8c.cjs +8 -0
  47. package/dist/search-dialog-D-DDN7zJ.js +208 -0
  48. package/dist/utils-CG65J0Sc.mjs +7 -0
  49. package/dist/utils-CKunkU96.cjs +7 -0
  50. package/dist/{worker-pool-BwU8ckrg.cjs → worker-pool-Crbqgw5R.cjs} +1 -1
  51. package/package.json +5 -5
  52. package/dist/chunk-Ds5LZdWN.cjs +0 -6
  53. package/dist/docs-layout-KoWNZc8_.js +0 -6
  54. package/dist/docs-layout-x2yKt2cL.cjs +0 -6
  55. package/dist/doctor-BD1BSB03.mjs +0 -23
  56. package/dist/doctor-BHc9ua6r.cjs +0 -23
  57. package/dist/generator-DGW6pkCC.cjs +0 -22
  58. package/dist/generator-Dv3wEmhZ.mjs +0 -22
  59. package/dist/icons-dev-B_RZIyxu.js +0 -6
  60. package/dist/icons-dev-BlV3wWFT.cjs +0 -6
  61. package/dist/image-BHhTvQzr.cjs +0 -6
  62. package/dist/image-CqKzYD8f.js +0 -6
  63. package/dist/mdx-DudBEac0.js +0 -7
  64. package/dist/mdx-r4cDQxWu.cjs +0 -7
  65. package/dist/meta-loader-0gJ4PtBC.cjs +0 -6
  66. package/dist/meta-loader-9IpAHWDS.mjs +0 -6
  67. package/dist/node-DBaH7kat.mjs +0 -111
  68. package/dist/node-t5C3Q85p.cjs +0 -111
  69. package/dist/parser-9cVdK7w9.mjs +0 -6
  70. package/dist/routes-DwrMa5-z.mjs +0 -6
  71. package/dist/search-dialog-B584t9ZF.js +0 -6
  72. package/dist/search-dialog-BvBopRsZ.cjs +0 -6
  73. package/dist/search-dialog-ByvGScjt.js +0 -6
  74. package/dist/search-dialog-Cyko6TJm.cjs +0 -6
  75. package/dist/search-dialog-D6BNohIJ.js +0 -6
  76. package/dist/search-dialog-DuYTIefy.cjs +0 -6
  77. package/dist/utils-BxNAXhZZ.mjs +0 -7
  78. package/dist/utils-Clzu7jvb.cjs +0 -7
  79. package/src/client/app/config-context.tsx +0 -51
  80. package/src/client/app/doc-page.tsx +0 -38
  81. package/src/client/app/docs-layout.tsx +0 -28
  82. package/src/client/app/head.tsx +0 -122
  83. package/src/client/app/helmet-compat.tsx +0 -36
  84. package/src/client/app/mdx-component.tsx +0 -8
  85. package/src/client/app/mdx-components-context.tsx +0 -72
  86. package/src/client/app/routes-context.tsx +0 -34
  87. package/src/client/app/scroll-handler.tsx +0 -74
  88. package/src/client/app/theme-context.tsx +0 -103
  89. package/src/client/app/ui-context.tsx +0 -42
  90. package/src/client/components/docs-layout-default.tsx +0 -85
  91. package/src/client/components/icons-dev.tsx +0 -282
  92. package/src/client/components/mdx/callout.tsx +0 -97
  93. package/src/client/components/mdx/card.tsx +0 -99
  94. package/src/client/components/mdx/cards.tsx +0 -27
  95. package/src/client/components/mdx/code-block.tsx +0 -184
  96. package/src/client/components/mdx/field.tsx +0 -33
  97. package/src/client/components/mdx/image.tsx +0 -44
  98. package/src/client/components/mdx/index.ts +0 -19
  99. package/src/client/components/mdx/table.tsx +0 -54
  100. package/src/client/components/mdx/typographics.tsx +0 -120
  101. package/src/client/components/mdx/use-code-block.ts +0 -34
  102. package/src/client/components/primitives/breadcrumbs.tsx +0 -54
  103. package/src/client/components/primitives/button-group.tsx +0 -54
  104. package/src/client/components/primitives/button.tsx +0 -6
  105. package/src/client/components/primitives/code-block.tsx +0 -120
  106. package/src/client/components/primitives/docs-layout.tsx +0 -125
  107. package/src/client/components/primitives/error-boundary.tsx +0 -107
  108. package/src/client/components/primitives/heading.tsx +0 -128
  109. package/src/client/components/primitives/helpers/observer.ts +0 -141
  110. package/src/client/components/primitives/image.tsx +0 -26
  111. package/src/client/components/primitives/link.tsx +0 -102
  112. package/src/client/components/primitives/menu.tsx +0 -137
  113. package/src/client/components/primitives/navbar.tsx +0 -466
  114. package/src/client/components/primitives/on-this-page.tsx +0 -430
  115. package/src/client/components/primitives/page-nav.tsx +0 -51
  116. package/src/client/components/primitives/popover.tsx +0 -28
  117. package/src/client/components/primitives/search-dialog.tsx +0 -193
  118. package/src/client/components/primitives/sidebar.tsx +0 -423
  119. package/src/client/components/primitives/skeleton.tsx +0 -26
  120. package/src/client/components/primitives/tabs.tsx +0 -70
  121. package/src/client/components/primitives/tooltip.tsx +0 -81
  122. package/src/client/components/primitives/types.ts +0 -11
  123. package/src/client/components/ui-base/banner.tsx +0 -66
  124. package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
  125. package/src/client/components/ui-base/copy-markdown.tsx +0 -107
  126. package/src/client/components/ui-base/error-boundary.tsx +0 -15
  127. package/src/client/components/ui-base/github-stars.tsx +0 -29
  128. package/src/client/components/ui-base/icons.tsx +0 -240
  129. package/src/client/components/ui-base/index.ts +0 -16
  130. package/src/client/components/ui-base/last-updated.tsx +0 -27
  131. package/src/client/components/ui-base/navbar.tsx +0 -266
  132. package/src/client/components/ui-base/not-found.tsx +0 -26
  133. package/src/client/components/ui-base/on-this-page.tsx +0 -57
  134. package/src/client/components/ui-base/page-nav.tsx +0 -50
  135. package/src/client/components/ui-base/search-dialog.tsx +0 -163
  136. package/src/client/components/ui-base/search-highlight.tsx +0 -10
  137. package/src/client/components/ui-base/sidebar.tsx +0 -92
  138. package/src/client/components/ui-base/tabs.tsx +0 -83
  139. package/src/client/components/ui-base/theme-toggle.tsx +0 -130
  140. package/src/client/components/ui-base/version-i18n.tsx +0 -80
  141. package/src/client/hooks/index.ts +0 -13
  142. package/src/client/hooks/use-analytics.ts +0 -272
  143. package/src/client/hooks/use-breadcrumbs.ts +0 -22
  144. package/src/client/hooks/use-i18n.ts +0 -182
  145. package/src/client/hooks/use-localized-to.ts +0 -113
  146. package/src/client/hooks/use-location.ts +0 -5
  147. package/src/client/hooks/use-navbar.ts +0 -130
  148. package/src/client/hooks/use-page-nav.ts +0 -46
  149. package/src/client/hooks/use-routes.ts +0 -108
  150. package/src/client/hooks/use-search-highlight.ts +0 -185
  151. package/src/client/hooks/use-search.ts +0 -118
  152. package/src/client/hooks/use-sidebar.ts +0 -205
  153. package/src/client/hooks/use-tabs.ts +0 -46
  154. package/src/client/hooks/use-version.ts +0 -111
  155. package/src/client/index.ts +0 -31
  156. package/src/client/mdx.ts +0 -2
  157. package/src/client/primitives.ts +0 -19
  158. package/src/client/ssg/boltdocs-shell.tsx +0 -148
  159. package/src/client/ssg/create-routes.tsx +0 -473
  160. package/src/client/ssg/index.ts +0 -4
  161. package/src/client/ssg/mdx-page.tsx +0 -38
  162. package/src/client/store/boltdocs-context.tsx +0 -137
  163. package/src/client/theme/neutral.css +0 -141
  164. package/src/client/theme/reset.css +0 -189
  165. package/src/client/types.ts +0 -116
  166. package/src/client/utils/cn.ts +0 -6
  167. package/src/client/utils/copy-clipboard.ts +0 -22
  168. package/src/client/utils/get-base-file-path.ts +0 -21
  169. package/src/client/utils/github.ts +0 -121
  170. package/src/client/utils/i18n.ts +0 -23
  171. package/src/client/utils/path.ts +0 -9
  172. package/src/client/utils/react-to-text.ts +0 -34
  173. package/src/client/virtual.d.ts +0 -24
  174. /package/dist/{worker-pool-Bd8Y9KDv.mjs → worker-pool-CGn7DrLb.mjs} +0 -0
@@ -1,430 +0,0 @@
1
- import {
2
- createContext,
3
- use,
4
- useEffect,
5
- useImperativeHandle,
6
- useMemo,
7
- useRef,
8
- useState,
9
- type ReactNode,
10
- type RefObject,
11
- } from 'react'
12
- import scrollIntoView from 'scroll-into-view-if-needed'
13
- import { cn } from '../../utils/cn'
14
- import type { ComponentBase } from './types'
15
- import { getItemId, Observer } from './helpers/observer'
16
-
17
- export interface TOCItemType {
18
- title: ReactNode
19
- url: string
20
- depth: number
21
- _step?: number
22
- }
23
-
24
- export type TableOfContents = TOCItemType[]
25
-
26
- export interface TOCItemInfo {
27
- id: string
28
- active: boolean
29
- /** last time the item is updated */
30
- t: number
31
- /** currently active but not intersecting in viewport */
32
- fallback: boolean
33
- original?: TOCItemType
34
- }
35
-
36
- export interface AnchorProviderProps {
37
- toc: TOCItemType[]
38
- /**
39
- * Only accept one active item at most
40
- * @defaultValue false
41
- */
42
- single?: boolean
43
- /**
44
- * Custom IntersectionObserver options
45
- */
46
- observerOptions?: IntersectionObserverInit
47
- children?: ReactNode
48
- }
49
-
50
- export interface ScrollProviderProps {
51
- /**
52
- * Scroll into the view of container when active
53
- */
54
- containerRef: RefObject<HTMLElement | null>
55
- children?: ReactNode
56
- }
57
-
58
- export interface OnThisPageContentProps extends ComponentBase {
59
- ref?: React.Ref<HTMLDivElement>
60
- scrollRef?: RefObject<HTMLElement | null>
61
- }
62
-
63
- export interface OnThisPageItemProps extends ComponentBase {
64
- level?: number
65
- }
66
-
67
- export interface OnThisPageLinkProps extends ComponentBase {
68
- href?: string
69
- active?: boolean
70
- onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void
71
- }
72
-
73
- export interface OnThisPageIndicatorProps extends ComponentBase {
74
- style?: React.CSSProperties
75
- }
76
-
77
- const ItemsContext = createContext<TOCItemInfo[] | null>(null)
78
- const ScrollContext = createContext<RefObject<HTMLElement | null> | null>(null)
79
-
80
- export function useItems() {
81
- const ctx = use(ItemsContext)
82
- if (!ctx)
83
- throw new Error(
84
- `Component must be used under the <AnchorProvider /> component.`,
85
- )
86
- return ctx
87
- }
88
-
89
- export function useActiveAnchor(): string | undefined {
90
- const items = useItems()
91
- return useMemo(() => {
92
- let out: TOCItemInfo | undefined
93
- for (const item of items) {
94
- if (!item.active) continue
95
- if (!out || item.t > out.t) {
96
- out = item
97
- }
98
- }
99
- return out?.id
100
- }, [items])
101
- }
102
-
103
- export function useActiveAnchors(): string[] {
104
- const items = useItems()
105
- return useMemo(() => {
106
- const out: string[] = []
107
- for (const item of items) {
108
- if (item.active) out.push(item.id)
109
- }
110
- return out
111
- }, [items])
112
- }
113
-
114
- /** Optional: add auto-scroll to TOC items. */
115
- export function ScrollProvider({
116
- containerRef,
117
- children,
118
- }: ScrollProviderProps) {
119
- return (
120
- <ScrollContext.Provider value={containerRef}>
121
- {children}
122
- </ScrollContext.Provider>
123
- )
124
- }
125
-
126
- export function AnchorProvider({
127
- toc,
128
- single = false,
129
- observerOptions,
130
- children,
131
- }: AnchorProviderProps) {
132
- const observer = useMemo(() => new Observer(), [])
133
- const [items, setItems] = useState<TOCItemInfo[]>(observer.items)
134
-
135
- observer.single = single
136
- useEffect(() => {
137
- observer.setItems(toc)
138
- }, [observer, toc])
139
-
140
- useEffect(() => {
141
- // We use a rootMargin that acts as an activation "line" near the top.
142
- // headings are "intersecting" (active=true) when they are BELOW this line.
143
- // Default to a more permissive margin for detecting visible headings
144
- const defaultOptions = {
145
- rootMargin: '-80px 0% -60% 0%',
146
- threshold: 0,
147
- }
148
- const options = observerOptions
149
- ? { ...defaultOptions, ...observerOptions }
150
- : defaultOptions
151
-
152
- observer.watch(options)
153
- observer.onChange = () => setItems([...observer.items])
154
-
155
- return () => {
156
- observer.unwatch()
157
- }
158
- }, [observer])
159
-
160
- return <ItemsContext.Provider value={items}>{children}</ItemsContext.Provider>
161
- }
162
-
163
- export const OnThisPage = ({ children, className }: ComponentBase) => {
164
- return (
165
- <nav
166
- className={cn(
167
- 'sticky top-navbar hidden xl:flex flex-col shrink-0',
168
- 'w-toc',
169
- 'py-4 pl-6 pr-4',
170
- className,
171
- )}
172
- >
173
- {children}
174
- </nav>
175
- )
176
- }
177
-
178
- const OnThisPageHeader = ({ children, className, ...props }: ComponentBase) => {
179
- return (
180
- <div
181
- className={cn('mb-4 text-xs font-bold text-body', className)}
182
- {...props}
183
- >
184
- {children}
185
- </div>
186
- )
187
- }
188
-
189
- const OnThisPageContent = ({
190
- children,
191
- className,
192
- ref,
193
- ...props
194
- }: OnThisPageContentProps) => {
195
- const internalRef = useRef<HTMLDivElement>(null)
196
-
197
- useImperativeHandle(ref, () => internalRef.current!)
198
-
199
- return (
200
- <div
201
- ref={internalRef}
202
- className={cn(
203
- 'relative overflow-y-auto boltdocs-otp-content pb-12',
204
- 'max-h-[70%]',
205
- className,
206
- )}
207
- style={{
208
- maskImage: 'linear-gradient(to bottom, black 90%, transparent 100%)',
209
- WebkitMaskImage:
210
- 'linear-gradient(to bottom, black 90%, transparent 100%)',
211
- }}
212
- {...props}
213
- >
214
- {children}
215
- </div>
216
- )
217
- }
218
-
219
- OnThisPageContent.displayName = 'OnThisPageContent'
220
-
221
- const OnThisPageList = ({ children, className }: ComponentBase) => {
222
- return (
223
- <ul
224
- className={cn(
225
- 'relative space-y-0.5 text-sm border-l border-subtle',
226
- className,
227
- )}
228
- >
229
- {children}
230
- </ul>
231
- )
232
- }
233
-
234
- const OnThisPageItem = ({
235
- level,
236
- children,
237
- className,
238
- }: OnThisPageItemProps) => {
239
- return <li className={cn(level === 3 && 'pl-3', className)}>{children}</li>
240
- }
241
-
242
- const OnThisPageLink = ({
243
- children,
244
- href,
245
- active,
246
- onClick,
247
- className,
248
- }: OnThisPageLinkProps) => {
249
- const items = use(ItemsContext)
250
- const containerRef = use(ScrollContext)
251
- const id = href ? getItemId(href) : null
252
- const anchorRef = useRef<HTMLAnchorElement>(null)
253
-
254
- const computedActive =
255
- active !== undefined
256
- ? active
257
- : id && items
258
- ? !!items.find((i) => i.id === id)?.active
259
- : false
260
-
261
- useEffect(() => {
262
- if (computedActive && anchorRef.current && containerRef?.current) {
263
- scrollIntoView(anchorRef.current, {
264
- behavior: 'smooth',
265
- block: 'center',
266
- inline: 'center',
267
- scrollMode: 'if-needed',
268
- boundary: containerRef.current,
269
- })
270
- }
271
- }, [computedActive, containerRef])
272
-
273
- const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
274
- if (onClick) {
275
- onClick(e)
276
- } else if (href && href.startsWith('#')) {
277
- e.preventDefault()
278
- const elementId = href.slice(1)
279
- const el = document.getElementById(elementId)
280
- if (el) {
281
- el.scrollIntoView({ behavior: 'smooth' })
282
- window.history.pushState(null, '', href)
283
- }
284
- }
285
- }
286
-
287
- return (
288
- <a
289
- ref={anchorRef}
290
- href={href}
291
- onClick={handleClick}
292
- data-active={computedActive}
293
- className={cn(
294
- 'block py-0.5 pl-4 text-[13px] outline-none transition-colors',
295
- computedActive ? 'text-primary-500' : 'text-muted hover:text-body',
296
- className,
297
- )}
298
- >
299
- {children}
300
- </a>
301
- )
302
- }
303
-
304
- const OnThisPageIndicator = ({
305
- style,
306
- className,
307
- }: OnThisPageIndicatorProps) => {
308
- const containerRef = useRef<HTMLDivElement>(null)
309
- const [internalStyle, setInternalStyle] = useState<React.CSSProperties>({
310
- opacity: 0,
311
- ...style,
312
- })
313
-
314
- const items = useItems()
315
-
316
- useEffect(() => {
317
- const parent = containerRef.current?.parentElement
318
- if (!parent) return
319
-
320
- const activeLinks = parent.querySelectorAll('a[data-active="true"]')
321
-
322
- if (activeLinks.length > 0) {
323
- const firstActiveLink = activeLinks[0] as HTMLElement
324
- const lastActiveLink = activeLinks[activeLinks.length - 1] as HTMLElement
325
-
326
- const firstRect = firstActiveLink.getBoundingClientRect()
327
- const lastRect = lastActiveLink.getBoundingClientRect()
328
- const parentRect = parent.getBoundingClientRect()
329
-
330
- const offsetTop = firstRect.top - parentRect.top
331
- const height = lastRect.bottom - firstRect.top
332
-
333
- setInternalStyle({
334
- transform: `translateY(${offsetTop}px)`,
335
- height: `${height}px`,
336
- opacity: 1,
337
- ...style,
338
- })
339
- } else {
340
- setInternalStyle({
341
- opacity: 0,
342
- ...style,
343
- })
344
- }
345
- }, [items, style])
346
-
347
- return (
348
- <div
349
- ref={containerRef}
350
- className={cn(
351
- 'absolute -left-px w-0.5 rounded-full bg-primary-500',
352
- className,
353
- )}
354
- style={{
355
- transition:
356
- 'transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), height 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 150ms',
357
- ...internalStyle,
358
- }}
359
- />
360
- )
361
- }
362
-
363
- /**
364
- * High-level automated list of toc items
365
- */
366
- export function OnThisPageItems({
367
- headings = [],
368
- className,
369
- }: {
370
- headings: { level: number; text: string; id: string }[]
371
- } & ComponentBase) {
372
- const activeIds = useActiveAnchors()
373
-
374
- if (headings.length === 0) return null
375
-
376
- return (
377
- <OnThisPageList className={className}>
378
- <OnThisPageIndicator />
379
- {headings.map((h) => (
380
- <OnThisPageItem key={h.id} level={h.level}>
381
- <OnThisPageLink href={`#${h.id}`} active={activeIds.includes(h.id)}>
382
- {h.text}
383
- </OnThisPageLink>
384
- </OnThisPageItem>
385
- ))}
386
- </OnThisPageList>
387
- )
388
- }
389
-
390
- /**
391
- * High-level automated Table of Contents tree
392
- */
393
- export function OnThisPageTree({
394
- headings = [],
395
- className,
396
- }: {
397
- headings: { level: number; text: string; id: string }[]
398
- } & ComponentBase) {
399
- const toc = useMemo(
400
- () =>
401
- headings.map((h) => ({ title: h.text, url: `#${h.id}`, depth: h.level })),
402
- [headings],
403
- )
404
-
405
- const scrollContainerRef = useRef<HTMLDivElement>(null)
406
-
407
- if (headings.length === 0) return null
408
-
409
- return (
410
- <AnchorProvider toc={toc} single={false}>
411
- <ScrollProvider containerRef={scrollContainerRef}>
412
- <OnThisPageContent ref={scrollContainerRef}>
413
- <OnThisPageItems headings={headings} className={className} />
414
- </OnThisPageContent>
415
- </ScrollProvider>
416
- </AnchorProvider>
417
- )
418
- }
419
-
420
- OnThisPage.Root = OnThisPage
421
- OnThisPage.Header = OnThisPageHeader
422
- OnThisPage.Content = OnThisPageContent
423
- OnThisPage.List = OnThisPageList
424
- OnThisPage.Item = OnThisPageItem
425
- OnThisPage.Link = OnThisPageLink
426
- OnThisPage.Indicator = OnThisPageIndicator
427
- OnThisPage.Items = OnThisPageItems
428
- OnThisPage.Tree = OnThisPageTree
429
-
430
- export default OnThisPage
@@ -1,51 +0,0 @@
1
- import { Link } from './link'
2
- import { ChevronLeft, ChevronRight } from '../ui-base/icons'
3
- import { cn } from '../../utils/cn'
4
- import type { ComponentBase } from './types'
5
-
6
- export interface PageNavProps extends ComponentBase {
7
- to: string
8
- direction: 'prev' | 'next'
9
- }
10
-
11
- export const PageNav = ({ children, className }: ComponentBase) => {
12
- return (
13
- <nav className={cn('grid sm:grid-cols-2 gap-4', className)}>{children}</nav>
14
- )
15
- }
16
-
17
- const PageNavLink = ({ children, to, direction, className }: PageNavProps) => {
18
- const isNext = direction === 'next'
19
- return (
20
- <Link
21
- href={to}
22
- className={cn(
23
- 'flex items-center outline-none no-underline',
24
- isNext ? 'justify-end' : 'justify-start',
25
- className,
26
- )}
27
- >
28
- {!isNext && <ChevronLeft className="shrink-0" />}
29
- <div className="flex flex-col flex-1">{children}</div>
30
- {isNext && <ChevronRight className="shrink-0" />}
31
- </Link>
32
- )
33
- }
34
-
35
- const PageNavTitle = ({ children, className }: ComponentBase) => {
36
- return <span className={cn(className)}>{children}</span>
37
- }
38
-
39
- const PageNavDescription = ({ children, className }: ComponentBase) => {
40
- return <span className={cn('truncate', className)}>{children}</span>
41
- }
42
-
43
- const PageNavIcon = ({ children }: ComponentBase) => {
44
- return <>{children}</>
45
- }
46
-
47
- PageNav.Root = PageNav
48
- PageNav.Link = PageNavLink
49
- PageNav.Title = PageNavTitle
50
- PageNav.Description = PageNavDescription
51
- PageNav.Icon = PageNavIcon
@@ -1,28 +0,0 @@
1
- import {
2
- Popover as RACPopover,
3
- type PopoverProps as RACPopoverProps,
4
- } from 'react-aria-components'
5
- import { cn } from '../../utils/cn'
6
-
7
- export interface PopoverProps extends Omit<RACPopoverProps, 'children'> {
8
- children: React.ReactNode
9
- className?: string
10
- }
11
-
12
- /**
13
- * A reusable Popover primitive with premium glassmorphism styling and smooth animations.
14
- */
15
- export const Popover = ({ children, className, ...props }: PopoverProps) => {
16
- return (
17
- <RACPopover
18
- offset={8}
19
- className={cn(
20
- 'z-50 overflow-auto outline-none transition-none',
21
- className,
22
- )}
23
- {...props}
24
- >
25
- {children as any}
26
- </RACPopover>
27
- )
28
- }
@@ -1,193 +0,0 @@
1
- 'use client'
2
-
3
- import * as RAC from 'react-aria-components'
4
- import { Hash, FileText, CornerDownLeft } from '../ui-base/icons'
5
- import { cn } from '../../utils/cn'
6
- import type { ComponentBase } from './types'
7
-
8
- export interface SearchDialogItemProps
9
- extends Omit<RAC.ListBoxItemProps, 'children'> {
10
- className?: string
11
- children: React.ReactNode
12
- }
13
-
14
- export interface SearchDialogItemIconProps {
15
- isHeading?: boolean
16
- className?: string
17
- }
18
-
19
- /**
20
- * Pure, unstyled SearchDialog Overlay (maps to RAC.ModalOverlay)
21
- */
22
- export const SearchDialog = ({
23
- className,
24
- ...props
25
- }: RAC.ModalOverlayProps) => {
26
- return (
27
- <RAC.ModalOverlay
28
- className={cn('fixed inset-0 z-100', className)}
29
- {...props}
30
- />
31
- )
32
- }
33
-
34
- /**
35
- * Pure, unstyled SearchDialog Content (maps to RAC.Modal)
36
- */
37
- const SearchDialogContent = ({
38
- className,
39
- ...props
40
- }: RAC.ModalOverlayProps) => <RAC.Modal className={cn(className)} {...props} />
41
-
42
- /**
43
- * Pure, unstyled SearchDialog Dialog (maps to RAC.Dialog)
44
- */
45
- const SearchDialogDialog = ({ className, ...props }: RAC.DialogProps) => (
46
- <RAC.Dialog
47
- className={cn('flex flex-col focus:outline-none', className)}
48
- {...props}
49
- />
50
- )
51
-
52
- /**
53
- * Pure, unstyled SearchDialog Input Field (maps to RAC.SearchField)
54
- */
55
- const SearchDialogField = ({ className, ...props }: RAC.SearchFieldProps) => (
56
- <RAC.SearchField className={cn('flex items-center', className)} {...props} />
57
- )
58
-
59
- /**
60
- * Pure, unstyled SearchInput (maps to RAC.Input)
61
- */
62
- const SearchDialogSearchInput = ({ className, ...props }: RAC.InputProps) => (
63
- <RAC.Input
64
- className={cn('w-full bg-transparent outline-none border-none', className)}
65
- {...props}
66
- />
67
- )
68
-
69
- /**
70
- * Pure, unstyled Clear Button (maps to RAC.Button with slot="clear")
71
- */
72
- const SearchDialogClearButton = ({ className, ...props }: RAC.ButtonProps) => (
73
- <RAC.Button slot="clear" className={cn(className)} {...props} />
74
- )
75
-
76
- /**
77
- * Pure, unstyled Autocomplete container (maps to RAC.Autocomplete)
78
- */
79
- const SearchDialogAutocomplete = <T extends object>({
80
- children,
81
- className,
82
- onSelectionChange,
83
- ...props
84
- }: RAC.AutocompleteProps<T> & {
85
- className?: string
86
- onSelectionChange?: (key: RAC.Key) => void
87
- }) => {
88
- const Autocomplete = RAC.Autocomplete as any
89
- return (
90
- <div className={cn('flex-1 min-h-0', className)}>
91
- <Autocomplete
92
- {...props}
93
- onSelectionChange={onSelectionChange}
94
- className="flex flex-col min-h-0"
95
- >
96
- {children}
97
- </Autocomplete>
98
- </div>
99
- )
100
- }
101
-
102
- /**
103
- * Pure, unstyled List Box (maps to RAC.ListBox)
104
- */
105
- const SearchDialogList = <T extends object>({
106
- children,
107
- className,
108
- ...props
109
- }: RAC.ListBoxProps<T> & { className?: string }) => {
110
- return (
111
- <RAC.ListBox
112
- {...props}
113
- className={cn('flex-1 overflow-y-auto outline-none min-h-0', className)}
114
- >
115
- {children as any}
116
- </RAC.ListBox>
117
- )
118
- }
119
-
120
- /**
121
- * Pure, unstyled List Box Item (maps to RAC.ListBoxItem)
122
- */
123
- const SearchDialogItemRoot = ({
124
- children,
125
- className,
126
- ...props
127
- }: SearchDialogItemProps) => {
128
- return (
129
- <RAC.ListBoxItem
130
- {...props}
131
- className={cn(
132
- 'group flex items-center outline-none cursor-pointer',
133
- className,
134
- )}
135
- >
136
- {(itemProps) => (
137
- <>
138
- {children}
139
- {(itemProps.isFocused || itemProps.isSelected) && (
140
- <div className="ml-auto opacity-50 flex items-center gap-1">
141
- <span className="text-[10px]">Select</span>
142
- <CornerDownLeft size={10} />
143
- </div>
144
- )}
145
- </>
146
- )}
147
- </RAC.ListBoxItem>
148
- )
149
- }
150
-
151
- const SearchDialogItemIcon = ({
152
- isHeading,
153
- className,
154
- }: SearchDialogItemIconProps) => {
155
- return (
156
- <div className={cn('shrink-0', className)}>
157
- {isHeading ? <Hash size={18} /> : <FileText size={18} />}
158
- </div>
159
- )
160
- }
161
-
162
- const SearchDialogItemTitle = ({ children, className }: ComponentBase) => {
163
- return (
164
- <span className={cn('block truncate flex-1', className)}>{children}</span>
165
- )
166
- }
167
-
168
- const SearchDialogItemBio = ({ children, className }: ComponentBase) => {
169
- return (
170
- <span className={cn('ml-2 truncate hidden sm:inline', className)}>
171
- {children}
172
- </span>
173
- )
174
- }
175
-
176
- // Compound API wiring
177
- SearchDialog.Root = SearchDialog
178
- SearchDialog.Overlay = SearchDialog
179
- SearchDialog.Content = SearchDialogContent
180
- SearchDialog.Dialog = SearchDialogDialog
181
- SearchDialog.Autocomplete = SearchDialogAutocomplete
182
- SearchDialog.List = SearchDialogList
183
-
184
- SearchDialog.Input = Object.assign(SearchDialogField, {
185
- SearchInput: SearchDialogSearchInput,
186
- Button: SearchDialogClearButton,
187
- })
188
-
189
- SearchDialog.Item = Object.assign(SearchDialogItemRoot, {
190
- Icon: SearchDialogItemIcon,
191
- Title: SearchDialogItemTitle,
192
- Bio: SearchDialogItemBio,
193
- })