agroptima-design-system 0.31.2-beta.2 → 0.31.2-beta.4

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.31.2-beta.2",
3
+ "version": "0.31.2-beta.4",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -4,6 +4,7 @@ import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'
4
4
  interface CommonProps {
5
5
  disabled?: boolean
6
6
  visible?: boolean
7
+ prefetch?: boolean
7
8
  }
8
9
 
9
10
  type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
@@ -20,18 +21,18 @@ const hasHref = (props: HtmlButtonProps | AnchorProps): props is AnchorProps =>
20
21
  export function BaseButton({
21
22
  children,
22
23
  visible = true,
24
+ prefetch = false,
23
25
  ...props
24
26
  }: BaseButtonProps) {
25
27
  if (!visible) return null
26
28
  const isLink = !props.disabled && hasHref(props)
27
29
  if (isLink) {
28
- const { href, prefetch = false, ...restProps } = props
30
+ const { href, ...restProps } = props
29
31
  return (
30
32
  <NextLink href={href} {...restProps} prefetch={prefetch}>
31
33
  {children}
32
34
  </NextLink>
33
35
  )
34
36
  }
35
-
36
37
  return <button {...(props as HtmlButtonProps)}>{children}</button>
37
38
  }
@@ -31,6 +31,7 @@ export function CardMenuOption({
31
31
  href,
32
32
  active,
33
33
  error,
34
+ prefetch = false,
34
35
  ...props
35
36
  }: CardMenuOptionProps): React.JSX.Element {
36
37
  const cssClasses = classNames('card-menu-option', variant, className, {
@@ -45,6 +46,7 @@ export function CardMenuOption({
45
46
  className={cssClasses}
46
47
  href={disabled ? '#' : href}
47
48
  aria-disabled={disabled}
49
+ prefetch={prefetch}
48
50
  {...props}
49
51
  >
50
52
  <div className="left">