@dbosoft/nextjs-uicore 1.5.1 → 1.6.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 (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/eslint.config.mjs +3 -3
  3. package/package.json +11 -6
  4. package/src/head/index.tsx +119 -119
  5. package/src/subnav/helpers/useStuckRef.ts +50 -50
  6. package/src/subnav/index.tsx +134 -135
  7. package/src/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.test.js +25 -25
  8. package/src/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.ts +17 -17
  9. package/src/subnav/partials/CtaLinks/github-stars-link/index.tsx +96 -96
  10. package/src/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.test.js +25 -25
  11. package/src/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.ts +25 -25
  12. package/src/subnav/partials/CtaLinks/icons/github.svg +3 -3
  13. package/src/subnav/partials/CtaLinks/index.tsx +46 -46
  14. package/src/subnav/partials/MenuItemsDefault/index.tsx +52 -52
  15. package/src/subnav/partials/MenuItemsDefault/style.module.scss +71 -71
  16. package/src/subnav/partials/MenuItemsOverflow/index.tsx +51 -51
  17. package/src/subnav/partials/MenuItemsOverflow/style.module.scss +51 -51
  18. package/src/subnav/partials/TitleLink/index.tsx +25 -25
  19. package/src/subnav/partials/nav-item-text/index.tsx +29 -29
  20. package/src/subnav/partials/nav-item-text/style.module.scss +19 -19
  21. package/src/subnav/style.module.scss +13 -13
  22. package/src/tabs/Tabs.tsx +50 -50
  23. package/src/tabs/TabsClient.tsx +75 -75
  24. package/src/tabs/index.ts +3 -3
  25. package/src/tabs/server.ts +2 -2
  26. package/src/themeselector/index.tsx +139 -139
  27. package/src/translations.ts +25 -25
  28. package/tsconfig.json +7 -7
  29. package/.turbo/turbo-build.log +0 -4
  30. package/.turbo/turbo-check-types.log +0 -4
@@ -1,4 +1,4 @@
1
- <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <title>GitHub</title>
3
- <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
1
+ <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
+ <title>GitHub</title>
3
+ <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
4
4
  </svg>
@@ -1,46 +1,46 @@
1
- import clsx from 'clsx'
2
- import LinkButton from '@dbosoft/react-uicore/linkbutton'
3
- import Link from 'next/link'
4
- import type { ICtaItem } from '../..'
5
- import GithubStarsLink from './github-stars-link'
6
-
7
- function CtaLinks(props: {
8
- links: ICtaItem[],
9
- hideGithubStars: boolean,
10
- isInDropdown: boolean
11
- }) {
12
- const { links, hideGithubStars, isInDropdown } = props
13
- return (
14
- <div className={clsx("flex gap-2", isInDropdown ? "pt-4 flex-col" : "items-center ml-4 space-x-1 ")}>
15
- {links.map((link, stableIdx) => {
16
-
17
- const textKey = link.text.toLowerCase()
18
- const isGithub = textKey === 'github'
19
-
20
- if (isGithub)
21
- return (
22
- <GithubStarsLink
23
-
24
- hideGithubStars={hideGithubStars}
25
- key={stableIdx}
26
- url={link.url}
27
- />
28
- )
29
- return (
30
- <LinkButton
31
-
32
- Link={Link}
33
- className={link.className}
34
- key={stableIdx}
35
- linktype={link.linktype}
36
- text={link.text}
37
- url={link.url}
38
- variant={link.variant}
39
- />
40
- )
41
- })}
42
- </div>
43
- )
44
- }
45
-
46
- export default CtaLinks
1
+ import clsx from 'clsx'
2
+ import LinkButton from '@dbosoft/react-uicore/linkbutton'
3
+ import Link from 'next/link'
4
+ import type { ICtaItem } from '../..'
5
+ import GithubStarsLink from './github-stars-link'
6
+
7
+ function CtaLinks(props: {
8
+ links: ICtaItem[],
9
+ hideGithubStars: boolean,
10
+ isInDropdown: boolean
11
+ }) {
12
+ const { links, hideGithubStars, isInDropdown } = props
13
+ return (
14
+ <div className={clsx("flex gap-2", isInDropdown ? "pt-4 flex-col" : "items-center ml-4 space-x-1 ")}>
15
+ {links.map((link, stableIdx) => {
16
+
17
+ const textKey = link.text.toLowerCase()
18
+ const isGithub = textKey === 'github'
19
+
20
+ if (isGithub)
21
+ return (
22
+ <GithubStarsLink
23
+
24
+ hideGithubStars={hideGithubStars}
25
+ key={stableIdx}
26
+ url={link.url}
27
+ />
28
+ )
29
+ return (
30
+ <LinkButton
31
+
32
+ Link={Link}
33
+ className={link.className}
34
+ key={stableIdx}
35
+ linktype={link.linktype}
36
+ text={link.text}
37
+ url={link.url}
38
+ variant={link.variant}
39
+ />
40
+ )
41
+ })}
42
+ </div>
43
+ )
44
+ }
45
+
46
+ export default CtaLinks
@@ -1,52 +1,52 @@
1
- import type { ReactElement } from 'react';
2
- import React from 'react'
3
- import LinkWrap from '@dbosoft/react-uicore/link-wrap'
4
- import NavItemText from '../nav-item-text'
5
- import type { MenuItem } from '../..'
6
- import Link from 'next/link';
7
-
8
- function MenuItemsDefault(props: {
9
- menuItems: MenuItem[]
10
- }) {
11
- const { menuItems } = props
12
-
13
- return (
14
- <ul
15
- className="inline-flex items-center">
16
- {menuItems.map((menuItem, stableIdx) => {
17
- if (menuItem === 'divider') {
18
- return <VerticalDivider key={stableIdx} />
19
- }
20
- const { text, url } = menuItem
21
- return <NavLink
22
- isActive={menuItem.active || false}
23
- key={stableIdx}
24
- text={text}
25
- url={url}
26
- />
27
- })}
28
- </ul>
29
- )
30
- }
31
- function VerticalDivider() {
32
- return (
33
- <li>
34
- <span className="bg-gray-400 dark:bg-gray-200 w-0.5 h-6 mx-1 block" />
35
- </li>
36
- )
37
- }
38
-
39
-
40
- function NavLink(props: { text: string; url: string; isActive: boolean }) {
41
- const { text, url, isActive } = props
42
- return (
43
- <li>
44
- <LinkWrap Link={Link} className="px-2" href={url}>
45
- <NavItemText isActive={isActive} text={text} />
46
- </LinkWrap>
47
- </li>
48
- )
49
- }
50
-
51
-
52
- export default MenuItemsDefault
1
+ import type { ReactElement } from 'react';
2
+ import React from 'react'
3
+ import LinkWrap from '@dbosoft/react-uicore/link-wrap'
4
+ import NavItemText from '../nav-item-text'
5
+ import type { MenuItem } from '../..'
6
+ import Link from 'next/link';
7
+
8
+ function MenuItemsDefault(props: {
9
+ menuItems: MenuItem[]
10
+ }) {
11
+ const { menuItems } = props
12
+
13
+ return (
14
+ <ul
15
+ className="inline-flex items-center">
16
+ {menuItems.map((menuItem, stableIdx) => {
17
+ if (menuItem === 'divider') {
18
+ return <VerticalDivider key={stableIdx} />
19
+ }
20
+ const { text, url } = menuItem
21
+ return <NavLink
22
+ isActive={menuItem.active || false}
23
+ key={stableIdx}
24
+ text={text}
25
+ url={url}
26
+ />
27
+ })}
28
+ </ul>
29
+ )
30
+ }
31
+ function VerticalDivider() {
32
+ return (
33
+ <li>
34
+ <span className="bg-gray-400 dark:bg-gray-200 w-0.5 h-6 mx-1 block" />
35
+ </li>
36
+ )
37
+ }
38
+
39
+
40
+ function NavLink(props: { text: string; url: string; isActive: boolean }) {
41
+ const { text, url, isActive } = props
42
+ return (
43
+ <li>
44
+ <LinkWrap Link={Link} className="px-2" href={url}>
45
+ <NavItemText isActive={isActive} text={text} />
46
+ </LinkWrap>
47
+ </li>
48
+ )
49
+ }
50
+
51
+
52
+ export default MenuItemsDefault
@@ -1,71 +1,71 @@
1
- .root {
2
- display: flex;
3
- padding: 0 32px;
4
- margin: 0 auto;
5
- align-items: center;
6
- list-style: none;
7
-
8
- &.alignRight {
9
- margin-right: 0;
10
- padding-right: 16px;
11
- }
12
- }
13
-
14
- .listItem {
15
- position: relative;
16
- white-space: nowrap;
17
- margin: 0;
18
- padding: 0;
19
- }
20
-
21
- .navLink {
22
- composes: g-type-body-small-strong from global;
23
- position: relative;
24
- padding: 0 16px;
25
- line-height: 2.5rem;
26
- display: flex;
27
- align-items: center;
28
- white-space: nowrap;
29
- }
30
-
31
- .submenuItem {
32
- composes: g-type-body-small-strong from global;
33
- color: var(--black);
34
- }
35
-
36
- .submenuModal {
37
- border-radius: 4px;
38
- box-shadow: 0 8px 12px rgba(37, 38, 45, 0.08);
39
- background: var(--white);
40
- z-index: 1;
41
- display: block;
42
- position: absolute;
43
- top: 100%;
44
- margin: 8px 0 0 0;
45
- padding: 24px;
46
- left: 50%;
47
- transform: translateX(-50%);
48
- list-style: none;
49
-
50
- & li {
51
- & a:hover .text {
52
- text-decoration: underline;
53
- }
54
-
55
- & + li {
56
- margin-top: 6px;
57
- }
58
- }
59
-
60
- &.isCollapsed {
61
- display: none;
62
- }
63
- }
64
-
65
- .verticalDivider {
66
- background: var(--gray-5);
67
- height: 1.75rem;
68
- width: 1px;
69
- margin: 0 8px;
70
- display: block;
71
- }
1
+ .root {
2
+ display: flex;
3
+ padding: 0 32px;
4
+ margin: 0 auto;
5
+ align-items: center;
6
+ list-style: none;
7
+
8
+ &.alignRight {
9
+ margin-right: 0;
10
+ padding-right: 16px;
11
+ }
12
+ }
13
+
14
+ .listItem {
15
+ position: relative;
16
+ white-space: nowrap;
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ .navLink {
22
+ composes: g-type-body-small-strong from global;
23
+ position: relative;
24
+ padding: 0 16px;
25
+ line-height: 2.5rem;
26
+ display: flex;
27
+ align-items: center;
28
+ white-space: nowrap;
29
+ }
30
+
31
+ .submenuItem {
32
+ composes: g-type-body-small-strong from global;
33
+ color: var(--black);
34
+ }
35
+
36
+ .submenuModal {
37
+ border-radius: 4px;
38
+ box-shadow: 0 8px 12px rgba(37, 38, 45, 0.08);
39
+ background: var(--white);
40
+ z-index: 1;
41
+ display: block;
42
+ position: absolute;
43
+ top: 100%;
44
+ margin: 8px 0 0 0;
45
+ padding: 24px;
46
+ left: 50%;
47
+ transform: translateX(-50%);
48
+ list-style: none;
49
+
50
+ & li {
51
+ & a:hover .text {
52
+ text-decoration: underline;
53
+ }
54
+
55
+ & + li {
56
+ margin-top: 6px;
57
+ }
58
+ }
59
+
60
+ &.isCollapsed {
61
+ display: none;
62
+ }
63
+ }
64
+
65
+ .verticalDivider {
66
+ background: var(--gray-5);
67
+ height: 1.75rem;
68
+ width: 1px;
69
+ margin: 0 8px;
70
+ display: block;
71
+ }
@@ -1,51 +1,51 @@
1
- import type { ReactElement } from 'react';
2
- import React from 'react'
3
- import LinkWrap from '@dbosoft/react-uicore/link-wrap'
4
- import CtaLinks from '../CtaLinks'
5
- import type { ICtaItem, MenuItem } from '../..'
6
- import s from './style.module.scss'
7
- import Link from 'next/link';
8
- import clsx from 'clsx'
9
-
10
- interface MenuItemsOverflowProps {
11
- menuItems: MenuItem[],
12
- ctaLinks: ICtaItem[],
13
- hideGithubStars: boolean,
14
- }
15
-
16
-
17
- export default function MenuItemsOverflow({ menuItems, ctaLinks, hideGithubStars }: MenuItemsOverflowProps) {
18
- return (<><ul className={s.ulElem}>
19
- {menuItems.map((menuItem, stableIdx) => {
20
- if (menuItem === 'divider') return null
21
-
22
- const { text, url } = menuItem
23
- return (
24
- <SubmenuItem
25
- active={menuItem.active || false}
26
- key={stableIdx}
27
- text={text}
28
- url={url}
29
- />
30
- )
31
- })}
32
- </ul>
33
- <CtaLinks
34
- hideGithubStars={hideGithubStars}
35
- isInDropdown
36
- links={ctaLinks}
37
- /></>)
38
-
39
- }
40
-
41
- function SubmenuItem({ url, text, active }: { url: string; text: string; active: boolean }) {
42
-
43
- return (
44
- <li>
45
- <LinkWrap Link={Link} className={clsx(s.submenuItem, "text-black dark:text-white" )} href={url} title={text}>
46
- {text}
47
- </LinkWrap>
48
- </li>
49
- )
50
- }
51
-
1
+ import type { ReactElement } from 'react';
2
+ import React from 'react'
3
+ import LinkWrap from '@dbosoft/react-uicore/link-wrap'
4
+ import CtaLinks from '../CtaLinks'
5
+ import type { ICtaItem, MenuItem } from '../..'
6
+ import s from './style.module.scss'
7
+ import Link from 'next/link';
8
+ import clsx from 'clsx'
9
+
10
+ interface MenuItemsOverflowProps {
11
+ menuItems: MenuItem[],
12
+ ctaLinks: ICtaItem[],
13
+ hideGithubStars: boolean,
14
+ }
15
+
16
+
17
+ export default function MenuItemsOverflow({ menuItems, ctaLinks, hideGithubStars }: MenuItemsOverflowProps) {
18
+ return (<><ul className={s.ulElem}>
19
+ {menuItems.map((menuItem, stableIdx) => {
20
+ if (menuItem === 'divider') return null
21
+
22
+ const { text, url } = menuItem
23
+ return (
24
+ <SubmenuItem
25
+ active={menuItem.active || false}
26
+ key={stableIdx}
27
+ text={text}
28
+ url={url}
29
+ />
30
+ )
31
+ })}
32
+ </ul>
33
+ <CtaLinks
34
+ hideGithubStars={hideGithubStars}
35
+ isInDropdown
36
+ links={ctaLinks}
37
+ /></>)
38
+
39
+ }
40
+
41
+ function SubmenuItem({ url, text, active }: { url: string; text: string; active: boolean }) {
42
+
43
+ return (
44
+ <li>
45
+ <LinkWrap Link={Link} className={clsx(s.submenuItem, "text-black dark:text-white" )} href={url} title={text}>
46
+ {text}
47
+ </LinkWrap>
48
+ </li>
49
+ )
50
+ }
51
+
@@ -1,51 +1,51 @@
1
- .root {
2
- position: relative;
3
- margin-left: auto;
4
- }
5
-
6
- .dropdown {
7
- background: var(--white);
8
- border-radius: 4px;
9
- box-shadow: 0 8px 12px rgba(37, 38, 45, 0.08);
10
- margin-top: 8px;
11
- max-height: calc(100vh - 300%);
12
- overflow-y: auto;
13
- padding: 12px 24px 0 24px;
14
- position: absolute;
15
- right: 0;
16
- top: 100%;
17
- width: 256px;
18
- z-index: 1;
19
-
20
- &.isCollapsed {
21
- display: none;
22
- }
23
- }
24
-
25
- .ulElem {
26
- padding: 0;
27
- margin: 0;
28
- list-style: none;
29
- }
30
-
31
- .submenuTitle {
32
- composes: g-type-label from global;
33
- margin: 12px 0 8px 0;
34
- color: var(--gray-3);
35
- }
36
-
37
- .divider {
38
- margin: 12px 0;
39
- border: 0;
40
- padding: 0;
41
- height: 1px;
42
- background: var(--gray-5);
43
- }
44
-
45
- .submenuItem {
46
- composes: g-type-body-small-strong from global;
47
- display: block;
48
- padding: 4px 0;
49
- line-height: 1.6em;
50
- color: var(--black);
51
- }
1
+ .root {
2
+ position: relative;
3
+ margin-left: auto;
4
+ }
5
+
6
+ .dropdown {
7
+ background: var(--white);
8
+ border-radius: 4px;
9
+ box-shadow: 0 8px 12px rgba(37, 38, 45, 0.08);
10
+ margin-top: 8px;
11
+ max-height: calc(100vh - 300%);
12
+ overflow-y: auto;
13
+ padding: 12px 24px 0 24px;
14
+ position: absolute;
15
+ right: 0;
16
+ top: 100%;
17
+ width: 256px;
18
+ z-index: 1;
19
+
20
+ &.isCollapsed {
21
+ display: none;
22
+ }
23
+ }
24
+
25
+ .ulElem {
26
+ padding: 0;
27
+ margin: 0;
28
+ list-style: none;
29
+ }
30
+
31
+ .submenuTitle {
32
+ composes: g-type-label from global;
33
+ margin: 12px 0 8px 0;
34
+ color: var(--gray-3);
35
+ }
36
+
37
+ .divider {
38
+ margin: 12px 0;
39
+ border: 0;
40
+ padding: 0;
41
+ height: 1px;
42
+ background: var(--gray-5);
43
+ }
44
+
45
+ .submenuItem {
46
+ composes: g-type-body-small-strong from global;
47
+ display: block;
48
+ padding: 4px 0;
49
+ line-height: 1.6em;
50
+ color: var(--black);
51
+ }
@@ -1,25 +1,25 @@
1
- import type { FC, ReactElement, ReactNode } from 'react'
2
- import LinkWrap from '@dbosoft/react-uicore/link-wrap'
3
- import Link from 'next/link'
4
-
5
-
6
- const TitleLink: FC<{
7
- text?: string,
8
- url: string,
9
- children?: ReactNode
10
- }> = ({
11
- text,
12
- url, children }) => {
13
- return (
14
- <LinkWrap
15
- Link={Link}
16
- className="font-bold text-gray-900 tracking-widest text-lg inline"
17
- href={url}
18
- title={text}
19
- >{text}
20
- {children}
21
- </LinkWrap>
22
- )
23
- }
24
-
25
- export default TitleLink
1
+ import type { FC, ReactElement, ReactNode } from 'react'
2
+ import LinkWrap from '@dbosoft/react-uicore/link-wrap'
3
+ import Link from 'next/link'
4
+
5
+
6
+ const TitleLink: FC<{
7
+ text?: string,
8
+ url: string,
9
+ children?: ReactNode
10
+ }> = ({
11
+ text,
12
+ url, children }) => {
13
+ return (
14
+ <LinkWrap
15
+ Link={Link}
16
+ className="font-semibold text-gray-900 tracking-widest text-lg inline"
17
+ href={url}
18
+ title={text}
19
+ >{text}
20
+ {children}
21
+ </LinkWrap>
22
+ )
23
+ }
24
+
25
+ export default TitleLink
@@ -1,29 +1,29 @@
1
- import clsx from 'clsx'
2
- import React from 'react'
3
-
4
- /**
5
- *
6
- * A span of styled text with
7
- * an active state that adds a thick
8
- * bottom border.
9
- *
10
- */
11
- function NavItemText({
12
- isActive,
13
- text,
14
- }: {
15
- /** If true, item will be rendered with a thick bottom border below the text. */
16
- isActive: boolean
17
- /** Plain text to render within the styled <span /> */
18
- text: string
19
- }): React.ReactElement {
20
- return (
21
- <span
22
- className={clsx("text-black dark:text-white text-sm font-semibold", isActive ? "border-b-2 pb-2 border-black" : "")}
23
- >
24
- {text}
25
- </span>
26
- )
27
- }
28
-
29
- export default NavItemText
1
+ import clsx from 'clsx'
2
+ import React from 'react'
3
+
4
+ /**
5
+ *
6
+ * A span of styled text with
7
+ * an active state that adds a thick
8
+ * bottom border.
9
+ *
10
+ */
11
+ function NavItemText({
12
+ isActive,
13
+ text,
14
+ }: {
15
+ /** If true, item will be rendered with a thick bottom border below the text. */
16
+ isActive: boolean
17
+ /** Plain text to render within the styled <span /> */
18
+ text: string
19
+ }): React.ReactElement {
20
+ return (
21
+ <span
22
+ className={clsx("text-black dark:text-white text-sm font-semibold", isActive ? "border-b-2 pb-2 border-black" : "")}
23
+ >
24
+ {text}
25
+ </span>
26
+ )
27
+ }
28
+
29
+ export default NavItemText