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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "0.30.3",
3
+ "version": "0.30.4-beta.1",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -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 = React.ButtonHTMLAttributes<HTMLButtonElement>
9
+ type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
9
10
 
10
- type AnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>
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={props.href || ''} {...props}>
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
- export interface MenuLinkProps
11
- extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
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
- href,
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 href={href} {...props} className={cssClasses}>
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>
@@ -161,7 +161,6 @@ function OptionList({
161
161
  <div className="select-options">
162
162
  {isSearchable && (
163
163
  <Input
164
- autoFocus
165
164
  label={searchLabel}
166
165
  hideLabel
167
166
  onChange={(e) => search(e.target.value)}
@@ -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>
@@ -164,7 +164,6 @@ function OptionList({
164
164
  <div className="select-options">
165
165
  {isSearchable && (
166
166
  <Input
167
- autoFocus
168
167
  label={searchLabel}
169
168
  hideLabel
170
169
  onChange={(e) => search(e.target.value)}
@@ -4,6 +4,10 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 0.30.4
8
+
9
+ * Add NextLink props to button link component.
10
+
7
11
  ## 0.30.3
8
12
 
9
13
  * Autofocus on search input in the Select and MultiSelect components.
@@ -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
  },