agroptima-design-system 1.2.26-beta.2 → 1.2.26-beta.3

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.26-beta.2",
3
+ "version": "1.2.26-beta.3",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -1,6 +1,5 @@
1
1
  import './Collapsible.scss'
2
- import type { ComponentPropsWithoutRef } from 'react'
3
- import { useState } from 'react'
2
+ import { type ComponentPropsWithoutRef, useEffect, useState } from 'react'
4
3
  import { classNames } from '../../utils/classNames'
5
4
  import { Icon } from '../Icon'
6
5
 
@@ -13,7 +12,6 @@ export interface CollapsibleProps extends ComponentPropsWithoutRef<'details'> {
13
12
  disabled?: boolean
14
13
  form?: boolean
15
14
  noHorizontalPadding?: boolean
16
- open?: boolean
17
15
  }
18
16
 
19
17
  export function Collapsible({
@@ -25,12 +23,13 @@ export function Collapsible({
25
23
  name,
26
24
  form = false,
27
25
  noHorizontalPadding = false,
28
- open = false,
29
- onToggle,
30
26
  ...props
31
27
  }: CollapsibleProps) {
32
- const [isOpen, setIsOpen] = useState(open)
28
+ const [isOpen, setIsOpen] = useState(props.open)
33
29
 
30
+ useEffect(() => {
31
+ setIsOpen(props.open)
32
+ }, [props.open])
34
33
  const cssClasses = classNames('collapsible', variant, className, {
35
34
  open: isOpen,
36
35
  disabled: disabled,
@@ -39,7 +38,7 @@ export function Collapsible({
39
38
  'no-horizontal-padding': noHorizontalPadding,
40
39
  form: form,
41
40
  })
42
- console.log('isOpen', isOpen)
41
+
43
42
  return (
44
43
  <details
45
44
  name={name}
@@ -47,7 +46,7 @@ export function Collapsible({
47
46
  aria-label={title}
48
47
  onToggle={(e) => {
49
48
  setIsOpen(e.currentTarget.open)
50
- onToggle?.(e)
49
+ props.onToggle?.(e)
51
50
  }}
52
51
  {...props}
53
52
  >