@lexibase/rdx-ui 1.0.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.
@@ -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 }