agroptima-design-system 0.31.2-beta.0 → 0.31.2-beta.2
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/package.json +1 -1
- package/src/atoms/Button/BaseButton.tsx +6 -4
- package/src/atoms/Card/Card.tsx +5 -4
- package/src/atoms/CardsTable/CardsTable.scss +1 -1
- package/src/atoms/Menu/MenuLink.tsx +7 -7
- package/src/atoms/Pagination/PaginationArrow.tsx +4 -1
- package/src/atoms/Pagination/PaginationNumber.tsx +4 -1
- package/src/atoms/Popover/PopoverMenuOption.tsx +4 -1
- package/src/generic/_helpers.scss +4 -0
- package/src/stories/Changelog.mdx +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import NextLink from 'next/link'
|
|
1
|
+
import NextLink, { type LinkProps } from 'next/link'
|
|
2
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'
|
|
2
3
|
|
|
3
4
|
interface CommonProps {
|
|
4
5
|
disabled?: boolean
|
|
5
6
|
visible?: boolean
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
type HtmlButtonProps =
|
|
9
|
+
type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
|
|
9
10
|
|
|
10
|
-
type AnchorProps =
|
|
11
|
+
type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProps
|
|
11
12
|
|
|
12
13
|
export type BaseButtonProps =
|
|
13
14
|
| (HtmlButtonProps & CommonProps)
|
|
@@ -24,8 +25,9 @@ export function BaseButton({
|
|
|
24
25
|
if (!visible) return null
|
|
25
26
|
const isLink = !props.disabled && hasHref(props)
|
|
26
27
|
if (isLink) {
|
|
28
|
+
const { href, prefetch = false, ...restProps } = props
|
|
27
29
|
return (
|
|
28
|
-
<NextLink href={
|
|
30
|
+
<NextLink href={href} {...restProps} prefetch={prefetch}>
|
|
29
31
|
{children}
|
|
30
32
|
</NextLink>
|
|
31
33
|
)
|
package/src/atoms/Card/Card.tsx
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import './Card.scss'
|
|
2
|
-
import Link from 'next/link'
|
|
2
|
+
import Link, { type LinkProps } from 'next/link'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
export type Variant = 'primary'
|
|
7
7
|
|
|
8
|
-
export interface CardProps {
|
|
8
|
+
export interface CardProps extends Omit<LinkProps, 'href'> {
|
|
9
9
|
visible?: boolean
|
|
10
10
|
className?: string
|
|
11
11
|
variant?: Variant
|
|
12
12
|
isDisabled?: boolean
|
|
13
13
|
isActive?: boolean
|
|
14
14
|
error?: boolean
|
|
15
|
-
href?: string
|
|
16
15
|
onClick?: () => void
|
|
17
16
|
role?: string
|
|
18
17
|
children: React.ReactNode
|
|
18
|
+
href?: string
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function Card({
|
|
@@ -25,6 +25,7 @@ export function Card({
|
|
|
25
25
|
isDisabled = false,
|
|
26
26
|
isActive = false,
|
|
27
27
|
error = false,
|
|
28
|
+
prefetch = false,
|
|
28
29
|
children,
|
|
29
30
|
href,
|
|
30
31
|
...props
|
|
@@ -40,7 +41,7 @@ export function Card({
|
|
|
40
41
|
|
|
41
42
|
if (href && !isDisabled) {
|
|
42
43
|
return (
|
|
43
|
-
<Link href={href} className={cssClasses} {...props}>
|
|
44
|
+
<Link href={href} className={cssClasses} prefetch={prefetch} {...props}>
|
|
44
45
|
{children}
|
|
45
46
|
</Link>
|
|
46
47
|
)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import './Menu.scss'
|
|
2
|
-
import Link from 'next/link'
|
|
3
|
-
import React from 'react'
|
|
2
|
+
import Link, { type LinkProps } from 'next/link'
|
|
3
|
+
import React, { type AnchorHTMLAttributes } from 'react'
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
import type { IconType } from '../Icon'
|
|
6
6
|
import { Icon } from '../Icon'
|
|
7
7
|
|
|
8
8
|
export type Variant = 'primary'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProps
|
|
11
|
+
|
|
12
|
+
export interface MenuLinkProps extends AnchorProps {
|
|
12
13
|
title: string
|
|
13
14
|
variant?: Variant
|
|
14
15
|
icon?: IconType
|
|
15
16
|
isActive?: boolean
|
|
16
|
-
href: string
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function MenuLink({
|
|
@@ -22,7 +22,7 @@ export function MenuLink({
|
|
|
22
22
|
className,
|
|
23
23
|
icon,
|
|
24
24
|
title,
|
|
25
|
-
|
|
25
|
+
prefetch = false,
|
|
26
26
|
...props
|
|
27
27
|
}: MenuLinkProps): React.JSX.Element {
|
|
28
28
|
const cssClasses = classNames('menu-item', variant, className, {
|
|
@@ -31,7 +31,7 @@ export function MenuLink({
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<li tabIndex={0} role="menuitem">
|
|
34
|
-
<Link
|
|
34
|
+
<Link {...props} prefetch={prefetch} className={cssClasses}>
|
|
35
35
|
{icon && <Icon name={icon} size="3" />}
|
|
36
36
|
<span className="title">{title}</span>
|
|
37
37
|
</Link>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './Pagination.scss'
|
|
2
|
+
import type { LinkProps } from 'next/link'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
import { classNames } from '../../utils/classNames'
|
|
4
5
|
import type { IconButtonProps } from '../Button'
|
|
@@ -6,7 +7,7 @@ import { IconButton } from '../Button'
|
|
|
6
7
|
|
|
7
8
|
export type Variant = 'primary'
|
|
8
9
|
|
|
9
|
-
export interface CustomProps {
|
|
10
|
+
export interface CustomProps extends LinkProps {
|
|
10
11
|
href: string
|
|
11
12
|
accessibilityLabel?: string
|
|
12
13
|
variant?: Variant
|
|
@@ -20,6 +21,7 @@ export function PaginationArrow({
|
|
|
20
21
|
href,
|
|
21
22
|
className,
|
|
22
23
|
disabled,
|
|
24
|
+
prefetch = false,
|
|
23
25
|
...props
|
|
24
26
|
}: PaginationArrowProps): React.JSX.Element {
|
|
25
27
|
const cssClasses = classNames('pagination-button', variant, className, {
|
|
@@ -32,6 +34,7 @@ export function PaginationArrow({
|
|
|
32
34
|
href={disabled ? '#' : href}
|
|
33
35
|
className={cssClasses}
|
|
34
36
|
accessibilityLabel={accessibilityLabel}
|
|
37
|
+
prefetch={prefetch}
|
|
35
38
|
{...props}
|
|
36
39
|
/>
|
|
37
40
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './Pagination.scss'
|
|
2
|
+
import type { LinkProps } from 'next/link'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
import { classNames } from '../../utils/classNames'
|
|
4
5
|
import type { ButtonProps } from '../Button'
|
|
@@ -14,7 +15,7 @@ export interface CustomProps {
|
|
|
14
15
|
variant?: Variant
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export type PaginationNumberProps = CustomProps & ButtonProps
|
|
18
|
+
export type PaginationNumberProps = CustomProps & ButtonProps & LinkProps
|
|
18
19
|
|
|
19
20
|
export function PaginationNumber({
|
|
20
21
|
label,
|
|
@@ -24,6 +25,7 @@ export function PaginationNumber({
|
|
|
24
25
|
className,
|
|
25
26
|
disabled,
|
|
26
27
|
selected = false,
|
|
28
|
+
prefetch = false,
|
|
27
29
|
...props
|
|
28
30
|
}: PaginationNumberProps): React.JSX.Element {
|
|
29
31
|
const cssClasses = classNames('pagination-button', variant, className, {
|
|
@@ -38,6 +40,7 @@ export function PaginationNumber({
|
|
|
38
40
|
href={disabled ? '#' : href}
|
|
39
41
|
className={cssClasses}
|
|
40
42
|
aria-current={selected}
|
|
43
|
+
prefetch={prefetch}
|
|
41
44
|
{...props}
|
|
42
45
|
/>
|
|
43
46
|
)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import './Popover.scss'
|
|
2
2
|
import type { LinkProps as NextLinkProps } from 'next/link'
|
|
3
3
|
import Link from 'next/link'
|
|
4
|
+
import React, { type AnchorHTMLAttributes } from 'react'
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
export type Variant = 'primary'
|
|
7
8
|
|
|
8
|
-
type LinkProps = NextLinkProps &
|
|
9
|
+
type LinkProps = NextLinkProps & AnchorHTMLAttributes<HTMLAnchorElement>
|
|
9
10
|
export interface PopoverMenuOptionProps extends LinkProps {
|
|
10
11
|
variant?: Variant
|
|
11
12
|
title: string
|
|
@@ -21,6 +22,7 @@ export function PopoverMenuOption({
|
|
|
21
22
|
disabled,
|
|
22
23
|
href,
|
|
23
24
|
active,
|
|
25
|
+
prefetch = false,
|
|
24
26
|
...props
|
|
25
27
|
}: PopoverMenuOptionProps): React.JSX.Element {
|
|
26
28
|
const cssClasses = classNames('popover-menu-option', variant, className, {
|
|
@@ -34,6 +36,7 @@ export function PopoverMenuOption({
|
|
|
34
36
|
className={cssClasses}
|
|
35
37
|
href={disabled ? '#' : href}
|
|
36
38
|
aria-disabled={disabled}
|
|
39
|
+
prefetch={prefetch}
|
|
37
40
|
{...props}
|
|
38
41
|
>
|
|
39
42
|
<span className="title">{title}</span>
|