agroptima-design-system 0.30.3 → 0.30.4-beta.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.
- package/package.json +1 -1
- package/src/atoms/Button/BaseButton.tsx +6 -4
- package/src/atoms/Menu/MenuLink.tsx +7 -7
- package/src/atoms/Multiselect.tsx +0 -1
- package/src/atoms/QuantitySelector.tsx +0 -2
- package/src/atoms/Select.tsx +0 -1
- package/src/stories/Changelog.mdx +4 -0
- package/src/stories/QuantitySelector.stories.ts +1 -3
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
|
)
|
|
@@ -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>
|
|
@@ -60,7 +60,6 @@ export function QuantitySelector({
|
|
|
60
60
|
className="decrement-button"
|
|
61
61
|
disabled={disabled}
|
|
62
62
|
onClick={handleDecrement}
|
|
63
|
-
tabIndex={-1}
|
|
64
63
|
/>
|
|
65
64
|
<Input
|
|
66
65
|
id={id}
|
|
@@ -80,7 +79,6 @@ export function QuantitySelector({
|
|
|
80
79
|
className="increment-button"
|
|
81
80
|
disabled={disabled}
|
|
82
81
|
onClick={handleIncrement}
|
|
83
|
-
tabIndex={-1}
|
|
84
82
|
/>
|
|
85
83
|
</div>
|
|
86
84
|
</div>
|
package/src/atoms/Select.tsx
CHANGED
|
@@ -8,9 +8,7 @@ const meta = {
|
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
|
-
'<h2>Usage guidelines</h2>'
|
|
12
|
-
'<p>Quantity Selector component is similar to text inputs, but is used to specify only a numeric value. Quantity Selector incrementally increases or decreases the value with a two-segment control.</p>' +
|
|
13
|
-
'<p>When using keyboard controls, increment and decrement buttons are ignored so the user is taken to the quantity input.</p>',
|
|
11
|
+
'<h2>Usage guidelines</h2><p>Quantity Selector component is similar to text inputs, but is used to specify only a numeric value. Quantity Selector incrementally increase or decrease the value with a two-segment control.</p>',
|
|
14
12
|
},
|
|
15
13
|
},
|
|
16
14
|
},
|