@popsure/dirty-swan 0.27.15 → 0.27.17

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.
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- export declare const AccordionItem: ({ children, className, headerClassName, iconSrc, isOpen, onOpen, onClose, title, }: {
2
+ export declare const AccordionItem: ({ children, className, headerClassName, isOpen, onOpen, onClose, label, }: {
3
3
  children: React.ReactNode | string;
4
4
  className?: string | undefined;
5
5
  headerClassName?: string | undefined;
6
- iconSrc?: string | undefined;
7
6
  isOpen: boolean;
8
7
  onOpen: () => void;
9
8
  onClose: () => void;
10
- title: string;
9
+ label: React.ReactNode;
11
10
  }) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.27.15",
3
+ "version": "0.27.17",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -25,20 +25,18 @@ export const AccordionItem = ({
25
25
  children,
26
26
  className = '',
27
27
  headerClassName = '',
28
- iconSrc = '',
29
28
  isOpen,
30
29
  onOpen,
31
30
  onClose,
32
- title,
31
+ label,
33
32
  }: {
34
33
  children: React.ReactNode | string;
35
34
  className?: string;
36
35
  headerClassName?: string;
37
- iconSrc?: string;
38
36
  isOpen: boolean;
39
37
  onOpen: () => void;
40
38
  onClose: () => void;
41
- title: string;
39
+ label: React.ReactNode;
42
40
  }) => {
43
41
  const handleClick = () => {
44
42
  if (!isOpen) {
@@ -56,8 +54,11 @@ export const AccordionItem = ({
56
54
  type="button"
57
55
  >
58
56
  <div className={`d-flex ai-center ${styles.iconAndTextContainer}`}>
59
- {!!iconSrc && <img src={iconSrc} alt={`${title} icon`} />}
60
- <h4 className="p-h4">{title}</h4>
57
+ {typeof label === 'string' ? (
58
+ <h4 className="p-h4">{label}</h4>
59
+ ) : (
60
+ <>{label}</>
61
+ )}
61
62
  </div>
62
63
  <ChevronSVG
63
64
  className={`${styles.chevron} ${!isOpen && styles.chevronClosed}`}
@@ -149,19 +149,19 @@ const ComparisonTable = <T extends { id: number }>(
149
149
  );
150
150
  });
151
151
 
152
+ const idString = `headerGroup-${headerGroup.id}`;
153
+
152
154
  return (
153
155
  <>
154
156
  {headerGroup.label && collapsibleSections ? (
155
157
  <AccordionItem
156
158
  className="mt8"
157
- title={String(headerGroup.label)}
159
+ label={headerGroup.label}
158
160
  headerClassName="p24 br8"
159
- isOpen={selectedSection === String(headerGroup.label)}
160
- onOpen={() =>
161
- setSelectedSection(String(headerGroup.label))
162
- }
161
+ isOpen={selectedSection === idString}
162
+ onOpen={() => setSelectedSection(idString)}
163
163
  onClose={() => setSelectedSection('')}
164
- key={String(headerGroup.label)}
164
+ key={idString}
165
165
  >
166
166
  <ScrollSyncPane>
167
167
  <div