agroptima-design-system 1.2.26 → 1.2.27
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
|
@@ -18,7 +18,7 @@ details summary::-webkit-details-marker {
|
|
|
18
18
|
user-select: none;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
.collapsible-header {
|
|
21
|
+
> .collapsible-header {
|
|
22
22
|
display: flex;
|
|
23
23
|
align-items: center;
|
|
24
24
|
gap: config.$space-3x;
|
|
@@ -32,7 +32,8 @@ details summary::-webkit-details-marker {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.collapsible-content {
|
|
35
|
+
> .collapsible-content {
|
|
36
|
+
display: none;
|
|
36
37
|
padding: config.$space-7x config.$space-7x config.$space-3x;
|
|
37
38
|
|
|
38
39
|
&.no-horizontal-padding {
|
|
@@ -41,17 +42,20 @@ details summary::-webkit-details-marker {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
&.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.collapsible-header {
|
|
48
|
-
background: transparent;
|
|
49
|
-
border-bottom: 3px solid var(--primary-color-600);
|
|
50
|
-
}
|
|
45
|
+
&.open {
|
|
46
|
+
> .collapsible-content {
|
|
47
|
+
display: block;
|
|
51
48
|
}
|
|
52
49
|
|
|
50
|
+
> .collapsible-header .collapsible-arrow {
|
|
51
|
+
transform: rotate(90deg);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&.primary,
|
|
56
|
+
&.secondary {
|
|
53
57
|
&.disabled {
|
|
54
|
-
.collapsible-header {
|
|
58
|
+
> .collapsible-header {
|
|
55
59
|
background: var(--neutral-color-50);
|
|
56
60
|
border-bottom: 1px solid var(--neutral-color-200);
|
|
57
61
|
color: var(--neutral-color-200);
|
|
@@ -59,7 +63,7 @@ details summary::-webkit-details-marker {
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
.collapsible-header {
|
|
66
|
+
> .collapsible-header {
|
|
63
67
|
color: var(--neutral-color-1000);
|
|
64
68
|
background: transparent;
|
|
65
69
|
border-bottom: 1px solid var(--neutral-color-200);
|
|
@@ -69,9 +73,14 @@ details summary::-webkit-details-marker {
|
|
|
69
73
|
background: var(--primary-color-50);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
76
|
+
|
|
77
|
+
&.open > .collapsible-header {
|
|
78
|
+
background: transparent;
|
|
79
|
+
border-bottom: 3px solid var(--primary-color-600);
|
|
80
|
+
}
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
&.secondary .collapsible-content {
|
|
83
|
+
&.secondary > .collapsible-content {
|
|
75
84
|
padding: config.$space-3x config.$space-4x config.$space-6x;
|
|
76
85
|
border: 1px solid var(--neutral-color-200);
|
|
77
86
|
border-top: none;
|
|
@@ -79,9 +88,3 @@ details summary::-webkit-details-marker {
|
|
|
79
88
|
border-bottom-right-radius: config.$corner-radius-m;
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
|
-
|
|
83
|
-
.collapsible[open] {
|
|
84
|
-
.collapsible-arrow {
|
|
85
|
-
transform: rotate(90deg);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './Collapsible.scss'
|
|
2
|
-
import type
|
|
2
|
+
import { type ComponentPropsWithoutRef, useState } from 'react'
|
|
3
3
|
import { classNames } from '../../utils/classNames'
|
|
4
4
|
import { Icon } from '../Icon'
|
|
5
5
|
|
|
@@ -23,10 +23,15 @@ export function Collapsible({
|
|
|
23
23
|
name,
|
|
24
24
|
form = false,
|
|
25
25
|
noHorizontalPadding = false,
|
|
26
|
+
open: controlledOpen,
|
|
27
|
+
onToggle,
|
|
26
28
|
...props
|
|
27
29
|
}: CollapsibleProps) {
|
|
30
|
+
const [expanded, setExpanded] = useState(false)
|
|
31
|
+
const isOpen = controlledOpen !== undefined ? controlledOpen : expanded
|
|
32
|
+
|
|
28
33
|
const cssClasses = classNames('collapsible', variant, className, {
|
|
29
|
-
open:
|
|
34
|
+
open: isOpen,
|
|
30
35
|
disabled: disabled,
|
|
31
36
|
})
|
|
32
37
|
const contentCssClasses = classNames('collapsible-content', {
|
|
@@ -35,7 +40,17 @@ export function Collapsible({
|
|
|
35
40
|
})
|
|
36
41
|
|
|
37
42
|
return (
|
|
38
|
-
<details
|
|
43
|
+
<details
|
|
44
|
+
open={isOpen}
|
|
45
|
+
name={name}
|
|
46
|
+
className={cssClasses}
|
|
47
|
+
aria-label={title}
|
|
48
|
+
onToggle={(e) => {
|
|
49
|
+
if (controlledOpen === undefined) setExpanded(e.currentTarget.open)
|
|
50
|
+
onToggle?.(e)
|
|
51
|
+
}}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
39
54
|
<summary className="collapsible-header">
|
|
40
55
|
<Icon className="collapsible-arrow" name="AngleRight" size="4" />
|
|
41
56
|
<span className="collapsible-title">{title}</span>
|