agroptima-design-system 1.2.24 → 1.2.26-beta.0

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": "1.2.24",
3
+ "version": "1.2.26-beta.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -43,7 +43,7 @@ details summary::-webkit-details-marker {
43
43
 
44
44
  &.primary,
45
45
  &.secondary {
46
- &[open] {
46
+ &.open {
47
47
  .collapsible-header {
48
48
  background: transparent;
49
49
  border-bottom: 3px solid var(--primary-color-600);
@@ -80,7 +80,7 @@ details summary::-webkit-details-marker {
80
80
  }
81
81
  }
82
82
 
83
- .collapsible[open] {
83
+ .collapsible.open {
84
84
  .collapsible-arrow {
85
85
  transform: rotate(90deg);
86
86
  }
@@ -1,5 +1,6 @@
1
1
  import './Collapsible.scss'
2
2
  import type { ComponentPropsWithoutRef } from 'react'
3
+ import { useState } from 'react'
3
4
  import { classNames } from '../../utils/classNames'
4
5
  import { Icon } from '../Icon'
5
6
 
@@ -12,6 +13,7 @@ export interface CollapsibleProps extends ComponentPropsWithoutRef<'details'> {
12
13
  disabled?: boolean
13
14
  form?: boolean
14
15
  noHorizontalPadding?: boolean
16
+ open?: boolean
15
17
  }
16
18
 
17
19
  export function Collapsible({
@@ -23,10 +25,14 @@ export function Collapsible({
23
25
  name,
24
26
  form = false,
25
27
  noHorizontalPadding = false,
28
+ open = false,
29
+ onToggle,
26
30
  ...props
27
31
  }: CollapsibleProps) {
32
+ const [isOpen, setIsOpen] = useState(open)
33
+
28
34
  const cssClasses = classNames('collapsible', variant, className, {
29
- open: props.open,
35
+ open: isOpen,
30
36
  disabled: disabled,
31
37
  })
32
38
  const contentCssClasses = classNames('collapsible-content', {
@@ -35,7 +41,17 @@ export function Collapsible({
35
41
  })
36
42
 
37
43
  return (
38
- <details name={name} className={cssClasses} aria-label={title} {...props}>
44
+ <details
45
+ name={name}
46
+ className={cssClasses}
47
+ aria-label={title}
48
+ open={isOpen}
49
+ onToggle={(e) => {
50
+ setIsOpen(e.currentTarget.open)
51
+ onToggle?.(e)
52
+ }}
53
+ {...props}
54
+ >
39
55
  <summary className="collapsible-header">
40
56
  <Icon className="collapsible-arrow" name="AngleRight" size="4" />
41
57
  <span className="collapsible-title">{title}</span>
@@ -47,6 +47,7 @@ import Notification from './notification.svg'
47
47
  import Orders from './orders.svg'
48
48
  import PDF from './pdf.svg'
49
49
  import Picture from './picture.svg'
50
+ import PriceList from './price-list.svg'
50
51
  import Product from './product.svg'
51
52
  import Reason from './reason.svg'
52
53
  import Receivables from './receivables.svg'
@@ -121,6 +122,7 @@ export {
121
122
  Orders,
122
123
  PDF,
123
124
  Picture,
125
+ PriceList,
124
126
  Product,
125
127
  Reason,
126
128
  Receivables,
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#price-list__a)"><path d="m19.424 12.25-7.159 7.15a2 2 0 0 1-.676.45c-.25.1-.5.15-.75.15s-.501-.05-.751-.15a2 2 0 0 1-.676-.45L.576 10.575A1.973 1.973 0 0 1 0 9.175V2C0 1.45.196.98.588.587A1.93 1.93 0 0 1 2.002 0h7.184a2.079 2.079 0 0 1 1.427.6l8.811 8.825c.2.2.346.425.438.675a2.062 2.062 0 0 1 0 1.488 1.874 1.874 0 0 1-.438.662ZM10.84 18l7.158-7.15L9.161 2H2.002v7.15L10.84 18ZM4.505 6a1.45 1.45 0 0 0 1.063-.438c.292-.291.439-.645.439-1.062 0-.417-.147-.77-.439-1.063A1.45 1.45 0 0 0 4.506 3a1.45 1.45 0 0 0-1.064.438A1.446 1.446 0 0 0 3.004 4.5c0 .417.146.77.438 1.063A1.45 1.45 0 0 0 4.506 6Z" fill="#444"/></g><defs><clipPath id="price-list__a"><path fill="#fff" d="M0 0h20v20H0z"/></clipPath></defs></svg>
@@ -4,6 +4,10 @@ import { Meta } from "@storybook/addon-docs/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 1.2.25
8
+
9
+ * Add PriceList icon
10
+
7
11
  ## 1.2.24
8
12
 
9
13
  * Replace `p` by `div` in NotificationLine component
@@ -68,6 +68,14 @@ describe('Icon', () => {
68
68
  })
69
69
  })
70
70
 
71
+ describe('Icon registry', () => {
72
+ it('renders the PriceList icon', () => {
73
+ const { getByRole } = render(<Icon name="PriceList" />)
74
+
75
+ expect(getByRole('img')).toHaveAttribute('aria-label', 'PriceList')
76
+ })
77
+ })
78
+
71
79
  describe('Visibility control', () => {
72
80
  it('does not render when visible is false', () => {
73
81
  const { container } = render(<Icon name="AngleLeft" visible={false} />)