@lexibase/rdx-ui 1.1.0 → 2.0.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.
- package/README.md +4 -5
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/package.json +3 -2
- package/src/components/button.tsx +20 -8
- package/src/components/code-block.tsx +4 -1
- package/src/components/copy-code-button.tsx +9 -6
- package/src/components/dialog.tsx +4 -1
- package/src/components/docs-search-dialog.tsx +23 -13
- package/src/components/docs-search.tsx +9 -5
- package/src/components/docs-sidebar.tsx +9 -7
- package/src/components/docs-toc.tsx +6 -3
- package/src/components/footer-credit.tsx +8 -4
- package/src/components/home.tsx +3 -3
- package/src/components/kbd.tsx +29 -0
- package/src/components/loading-button.tsx +5 -1
- package/src/components/mdx-components.tsx +59 -35
- package/src/components/mode-toggle.tsx +5 -2
- package/src/components/navbar.tsx +13 -9
- package/src/components/not-found.tsx +36 -0
- package/src/components/table.tsx +122 -0
- package/src/components/tabs.tsx +10 -7
- package/src/components/version-dropdown.tsx +9 -2
- package/src/components/version-notice.tsx +7 -5
- package/src/lib/i18n.ts +144 -0
- package/src/providers/locale-provider.tsx +29 -0
- package/src/components/button-link.tsx +0 -27
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, type ReactNode } from 'react'
|
|
4
|
+
import { getMessages, resolveInterfaceLocale } from '../lib/i18n'
|
|
5
|
+
|
|
6
|
+
const LocaleContext = createContext('en')
|
|
7
|
+
|
|
8
|
+
/** Use the configured locale on both server rendering and hydration. */
|
|
9
|
+
export function LocaleProvider({
|
|
10
|
+
lang,
|
|
11
|
+
children,
|
|
12
|
+
}: {
|
|
13
|
+
lang?: string
|
|
14
|
+
children: ReactNode
|
|
15
|
+
}) {
|
|
16
|
+
return (
|
|
17
|
+
<LocaleContext.Provider value={resolveInterfaceLocale(lang)}>
|
|
18
|
+
{children}
|
|
19
|
+
</LocaleContext.Provider>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function useInterfaceLocale() {
|
|
24
|
+
return useContext(LocaleContext)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useMessages() {
|
|
28
|
+
return getMessages(useInterfaceLocale())
|
|
29
|
+
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import Link from 'next/link'
|
|
4
|
-
import type { ComponentProps } from 'react'
|
|
5
|
-
import type { VariantProps } from 'class-variance-authority'
|
|
6
|
-
|
|
7
|
-
import { buttonVariants } from './button'
|
|
8
|
-
import { cn } from '../lib/utils'
|
|
9
|
-
|
|
10
|
-
/** Navigation keeps native anchor semantics, independent of button behavior. */
|
|
11
|
-
function ButtonLink({
|
|
12
|
-
className,
|
|
13
|
-
variant,
|
|
14
|
-
size,
|
|
15
|
-
active,
|
|
16
|
-
...props
|
|
17
|
-
}: ComponentProps<typeof Link> & VariantProps<typeof buttonVariants>) {
|
|
18
|
-
return (
|
|
19
|
-
<Link
|
|
20
|
-
data-slot="button"
|
|
21
|
-
className={cn(buttonVariants({ variant, size, active }), className)}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { ButtonLink }
|