agroptima-design-system 0.27.17 → 0.27.18

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.27.17",
3
+ "version": "0.27.18",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -24,16 +24,16 @@
24
24
  "@chromatic-com/storybook": "^3.2.2",
25
25
  "@eslint/eslintrc": "^3.1.0",
26
26
  "@eslint/js": "^9.14.0",
27
- "@storybook/addon-a11y": "^8.4.5",
27
+ "@storybook/addon-a11y": "^8.4.7",
28
28
  "@storybook/addon-designs": "^8.0.4",
29
- "@storybook/addon-essentials": "^8.4.5",
30
- "@storybook/addon-interactions": "^8.4.5",
31
- "@storybook/addon-links": "^8.4.5",
32
- "@storybook/addon-viewport": "^8.4.5",
33
- "@storybook/blocks": "^8.4.5",
34
- "@storybook/nextjs": "^8.4.5",
35
- "@storybook/react": "^8.4.5",
36
- "@storybook/test": "^8.4.5",
29
+ "@storybook/addon-essentials": "^8.4.7",
30
+ "@storybook/addon-interactions": "^8.4.7",
31
+ "@storybook/addon-links": "^8.4.7",
32
+ "@storybook/addon-viewport": "^8.4.7",
33
+ "@storybook/blocks": "^8.4.7",
34
+ "@storybook/nextjs": "^8.4.7",
35
+ "@storybook/react": "^8.4.7",
36
+ "@storybook/test": "^8.4.7",
37
37
  "@svgr/webpack": "^8.1.0",
38
38
  "@testing-library/jest-dom": "^6.6.3",
39
39
  "@testing-library/react": "^16.0.1",
@@ -53,7 +53,7 @@
53
53
  "jest-axe": "^9.0.0",
54
54
  "jest-environment-jsdom": "^29.7.0",
55
55
  "prettier": "3.3.3",
56
- "storybook": "^8.4.5",
56
+ "storybook": "^8.4.7",
57
57
  "ts-node": "^10.9.2",
58
58
  "typescript": "^5.6.3"
59
59
  },
@@ -22,7 +22,8 @@ export function BaseButton({
22
22
  ...props
23
23
  }: BaseButtonProps) {
24
24
  if (!visible) return null
25
- if (hasHref(props)) {
25
+ const isLink = !props.disabled && hasHref(props)
26
+ if (isLink) {
26
27
  return (
27
28
  <NextLink href={props.href || ''} {...props}>
28
29
  {children}
@@ -4,6 +4,10 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 0.27.18
8
+
9
+ * Buttons links can be disabled.
10
+
7
11
  ## 0.27.17
8
12
 
9
13
  * Add the searchable parameter as optional in Select component.
@@ -1,6 +1,6 @@
1
1
  import type { ButtonVariant } from '../src/atoms/Button/Button'
2
2
  import React from 'react'
3
- import { screen, render } from '@testing-library/react'
3
+ import { screen, render, getByRole } from '@testing-library/react'
4
4
  import userEvent from '@testing-library/user-event'
5
5
  import { Button } from '../src/atoms/Button/Button'
6
6
 
@@ -110,4 +110,17 @@ describe('Button', () => {
110
110
 
111
111
  expect(onClickEvent).not.toHaveBeenCalled()
112
112
  })
113
+
114
+ it('renders a button when link is disabled', async () => {
115
+ const { getByRole } = render(
116
+ <Button
117
+ id="disabled-button"
118
+ label="Disabled button"
119
+ href="/any-link.com"
120
+ disabled
121
+ />,
122
+ )
123
+
124
+ expect(getByRole('button')).toBeInTheDocument()
125
+ })
113
126
  })