@dbosoft/nextjs-uicore 1.3.0 → 1.5.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/CHANGELOG.md +22 -0
- package/eslint.config.mjs +3 -0
- package/package.json +14 -12
- package/src/subnav/index.tsx +14 -3
- package/src/subnav/partials/CtaLinks/github-stars-link/index.tsx +11 -2
- package/src/themeselector/index.tsx +30 -10
- package/src/translations.ts +25 -0
- package/.eslintrc.js +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @dbosoft/nextjs-uicore
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- nextjs 16 / react 19 / tailwind 4 upgrade
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @dbosoft/react-uicore@1.3.0
|
|
13
|
+
|
|
14
|
+
## 1.4.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- 05d3074: i18n support for DE/EN
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [05d3074]
|
|
23
|
+
- @dbosoft/react-uicore@1.2.0
|
|
24
|
+
|
|
3
25
|
## 1.3.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@dbosoft/nextjs-uicore",
|
|
3
3
|
"description": "Core UI components for Next.js",
|
|
4
4
|
"author": "dbosoft",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.5.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"exports": {
|
|
@@ -11,28 +11,30 @@
|
|
|
11
11
|
"./tabs": "./src/tabs/index.ts",
|
|
12
12
|
"./tabs/server": "./src/tabs/server.ts",
|
|
13
13
|
"./subnav": "./src/subnav/index.tsx",
|
|
14
|
-
"./themeselector": "./src/themeselector/index.tsx"
|
|
14
|
+
"./themeselector": "./src/themeselector/index.tsx",
|
|
15
|
+
"./translations": "./src/translations.ts"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@types/react": "^
|
|
18
|
-
"@types/react-dom": "^
|
|
19
|
-
"eslint": "^
|
|
20
|
-
"next": "^
|
|
21
|
-
"react": "^
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"@dbosoft/
|
|
18
|
+
"@types/react": "^19.0.0",
|
|
19
|
+
"@types/react-dom": "^19.0.0",
|
|
20
|
+
"eslint": "^9.0.0",
|
|
21
|
+
"next": "^16.0.0",
|
|
22
|
+
"react": "^19.0.0",
|
|
23
|
+
"react-dom": "^19.0.0",
|
|
24
|
+
"typescript": "^5.8.0",
|
|
25
|
+
"@dbosoft/eslint-config": "2.0.0",
|
|
26
|
+
"@dbosoft/typescript-config": "1.1.0",
|
|
25
27
|
"@dbosoft/web-types": "1.0.0"
|
|
26
28
|
},
|
|
27
29
|
"publishConfig": {
|
|
28
30
|
"access": "public"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@dbosoft/react-uicore": ">=1.1.0",
|
|
32
33
|
"@headlessui/react": ">=2.2.0",
|
|
33
34
|
"@heroicons/react": ">=2.1.0",
|
|
34
35
|
"clsx": ">=2.1.0",
|
|
35
|
-
"next-themes": ">=0.4.3"
|
|
36
|
+
"next-themes": ">=0.4.3",
|
|
37
|
+
"@dbosoft/react-uicore": "1.3.0"
|
|
36
38
|
},
|
|
37
39
|
"scripts": {
|
|
38
40
|
"lint": "eslint . --max-warnings 0",
|
package/src/subnav/index.tsx
CHANGED
|
@@ -38,6 +38,14 @@ export interface ICtaItem {
|
|
|
38
38
|
className?: string,
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export interface SubNavLabels {
|
|
42
|
+
openMainMenu: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const defaultSubNavLabels: SubNavLabels = {
|
|
46
|
+
openMainMenu: 'Open main menu',
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
interface ISubNavProps {
|
|
42
50
|
titleLink?: ITitleLink,
|
|
43
51
|
titleContent?: JSX.Element,
|
|
@@ -45,7 +53,8 @@ interface ISubNavProps {
|
|
|
45
53
|
hideGithubStars: boolean
|
|
46
54
|
menuItems: MenuItem[],
|
|
47
55
|
menuItemsAlign: 'left' | 'right',
|
|
48
|
-
className?: string
|
|
56
|
+
className?: string,
|
|
57
|
+
labels?: Partial<SubNavLabels>
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
function Subnav({
|
|
@@ -55,8 +64,10 @@ function Subnav({
|
|
|
55
64
|
hideGithubStars,
|
|
56
65
|
menuItems,
|
|
57
66
|
menuItemsAlign = `right`,
|
|
58
|
-
titleContent
|
|
67
|
+
titleContent,
|
|
68
|
+
labels: labelsProp
|
|
59
69
|
}: ISubNavProps) {
|
|
70
|
+
const labels = { ...defaultSubNavLabels, ...labelsProp }
|
|
60
71
|
|
|
61
72
|
const { isStuck, stuckRef } = useStuckRef([])
|
|
62
73
|
|
|
@@ -93,7 +104,7 @@ function Subnav({
|
|
|
93
104
|
<div className="-mr-2 flex items-center sm:hidden ">
|
|
94
105
|
{/* Mobile menu button */}
|
|
95
106
|
<DisclosureButton className="bg-white inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-secondary">
|
|
96
|
-
<span className="sr-only">
|
|
107
|
+
<span className="sr-only">{labels.openMainMenu}</span>
|
|
97
108
|
{open ? (
|
|
98
109
|
<XMarkIcon aria-hidden="true" className="block h-6 w-6" />
|
|
99
110
|
) : (
|
|
@@ -9,7 +9,16 @@ import formatStarCount from './formatStarCount'
|
|
|
9
9
|
import parseGithubUrl from './parseGithubUrl'
|
|
10
10
|
import Link from 'next/link';
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export interface GithubStarsLinkLabels {
|
|
13
|
+
github: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const defaultGithubStarsLinkLabels: GithubStarsLinkLabels = {
|
|
17
|
+
github: 'Github',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function GithubStarsButton({ url, hideGithubStars, labels: labelsProp }: { url: string, hideGithubStars: boolean, labels?: Partial<GithubStarsLinkLabels> }) {
|
|
21
|
+
const labels = { ...defaultGithubStarsLinkLabels, ...labelsProp }
|
|
13
22
|
const [starCount, setStarCount] = useState(-1)
|
|
14
23
|
|
|
15
24
|
useEffect(() => {
|
|
@@ -62,7 +71,7 @@ function GithubStarsButton({ url, hideGithubStars }: { url: string, hideGithubSt
|
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
return (
|
|
65
|
-
<LinkButton icon={!showStarCount ? icon : undefined} label=
|
|
74
|
+
<LinkButton icon={!showStarCount ? icon : undefined} label={labels.github} text={!showStarCount ? labels.github : ""}
|
|
66
75
|
variant='neutral'
|
|
67
76
|
url={url} external
|
|
68
77
|
Link={Link}
|
|
@@ -3,11 +3,21 @@ import { useTheme } from 'next-themes'
|
|
|
3
3
|
import { Listbox, ListboxButton, ListboxLabel, ListboxOption, ListboxOptions } from '@headlessui/react'
|
|
4
4
|
import clsx from 'clsx'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export interface ThemeSelectorLabels {
|
|
7
|
+
light: string
|
|
8
|
+
dark: string
|
|
9
|
+
system: string
|
|
10
|
+
theme: string
|
|
11
|
+
themeAriaLabel: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const defaultThemeSelectorLabels: ThemeSelectorLabels = {
|
|
15
|
+
light: 'Light',
|
|
16
|
+
dark: 'Dark',
|
|
17
|
+
system: 'System',
|
|
18
|
+
theme: 'Theme',
|
|
19
|
+
themeAriaLabel: 'Theme',
|
|
20
|
+
}
|
|
11
21
|
|
|
12
22
|
function LightIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
|
|
13
23
|
return (
|
|
@@ -45,9 +55,19 @@ function SystemIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
|
|
|
45
55
|
)
|
|
46
56
|
}
|
|
47
57
|
|
|
48
|
-
export function ThemeSelector(
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
export function ThemeSelector({
|
|
59
|
+
labels: labelsProp,
|
|
60
|
+
...props
|
|
61
|
+
}: React.ComponentPropsWithoutRef<typeof Listbox<'div'>> & {
|
|
62
|
+
labels?: Partial<ThemeSelectorLabels>
|
|
63
|
+
}) {
|
|
64
|
+
const labels = { ...defaultThemeSelectorLabels, ...labelsProp }
|
|
65
|
+
const themes = [
|
|
66
|
+
{ name: labels.light, value: 'light', icon: LightIcon },
|
|
67
|
+
{ name: labels.dark, value: 'dark', icon: DarkIcon },
|
|
68
|
+
{ name: labels.system, value: 'system', icon: SystemIcon },
|
|
69
|
+
]
|
|
70
|
+
|
|
51
71
|
let { theme, setTheme } = useTheme()
|
|
52
72
|
let [mounted, setMounted] = useState(false)
|
|
53
73
|
|
|
@@ -61,10 +81,10 @@ export function ThemeSelector(
|
|
|
61
81
|
|
|
62
82
|
return (
|
|
63
83
|
<Listbox as="div" value={theme} onChange={setTheme} {...props}>
|
|
64
|
-
<ListboxLabel className="sr-only">
|
|
84
|
+
<ListboxLabel className="sr-only">{labels.theme}</ListboxLabel>
|
|
65
85
|
<ListboxButton
|
|
66
86
|
className="flex h-9 w-12 mt-3 items-center justify-center rounded-lg shadow-md shadow-black/5 ring-1 ring-black/5 dark:bg-slate-700 dark:ring-inset dark:ring-white/5"
|
|
67
|
-
aria-label=
|
|
87
|
+
aria-label={labels.themeAriaLabel}
|
|
68
88
|
>
|
|
69
89
|
<LightIcon
|
|
70
90
|
className={clsx(
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ThemeSelectorLabels } from './themeselector'
|
|
2
|
+
import type { SubNavLabels } from './subnav'
|
|
3
|
+
import type { GithubStarsLinkLabels } from './subnav/partials/CtaLinks/github-stars-link'
|
|
4
|
+
|
|
5
|
+
export const themeSelectorLabels: { de: ThemeSelectorLabels } = {
|
|
6
|
+
de: {
|
|
7
|
+
light: 'Hell',
|
|
8
|
+
dark: 'Dunkel',
|
|
9
|
+
system: 'System',
|
|
10
|
+
theme: 'Design',
|
|
11
|
+
themeAriaLabel: 'Design',
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const subNavLabels: { de: SubNavLabels } = {
|
|
16
|
+
de: {
|
|
17
|
+
openMainMenu: 'Hauptmenü öffnen',
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const githubStarsLinkLabels: { de: GithubStarsLinkLabels } = {
|
|
22
|
+
de: {
|
|
23
|
+
github: 'Github',
|
|
24
|
+
},
|
|
25
|
+
}
|
package/.eslintrc.js
DELETED