@npm_leadtech/legal-lib-components 5.7.6 → 5.7.8

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.
@@ -2,11 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  import { ChevronRight24px } from '../../../../images/componentsSvg/ChevronRight24px';
4
4
  // import './FaqItem.scss'
5
- export const FaqItem = ({ slug, title, children, index }) => {
6
- const [isOpen, setIsOpen] = React.useState(index === 0);
7
- return (_jsxs("article", { className: `faqItem ${isOpen ? '' : 'open'}`, children: [_jsx("div", { id: slug, className: 'fakeAnchor' }), _jsxs("details", { itemProp: 'mainEntity', itemScope: true, itemType: 'https://www.schema.org/Question', className: 'content', open: index === 0 ? true : false, children: [_jsxs("summary", { role: 'button', tabIndex: index === 0 ? 0 : -1, onClick: () => {
5
+ export const FaqItem = ({ slug, title, children }) => {
6
+ const [isOpen, setIsOpen] = React.useState(false);
7
+ return (_jsxs("article", { className: `faqItem ${isOpen ? 'open' : ''}`, children: [_jsx("div", { id: slug, className: 'fakeAnchor' }), _jsxs("details", { itemProp: 'mainEntity', itemScope: true, itemType: 'https://www.schema.org/Question', className: 'content', open: isOpen, children: [_jsxs("summary", { role: 'button', tabIndex: isOpen ? 0 : -1, onClick: (e) => {
8
+ e.preventDefault();
8
9
  setIsOpen(!isOpen);
9
10
  }, onKeyUp: () => {
10
11
  setIsOpen(!isOpen);
11
- }, className: 'question', children: [_jsx("h3", { tabIndex: index === 0 ? 0 : -1, itemProp: 'name', className: 'title', children: title }), _jsx(ChevronRight24px, {})] }), _jsx("div", { itemScope: true, itemProp: 'acceptedAnswer', itemType: 'https://www.schema.org/Answer', className: 'answer', children: _jsx("span", { itemProp: 'text', children: children }) })] })] }));
12
+ }, className: 'question', children: [_jsx("h3", { itemProp: 'name', className: 'title', children: title }), _jsx(ChevronRight24px, {})] }), _jsx("div", { itemScope: true, itemProp: 'acceptedAnswer', itemType: 'https://www.schema.org/Answer', className: 'answer', children: _jsx("span", { itemProp: 'text', children: children }) })] })] }));
12
13
  };
@@ -4,23 +4,24 @@ import { ChevronRight24px } from '../../../../images/componentsSvg/ChevronRight2
4
4
  import { type FaqItemProps } from './FaqItemProps'
5
5
  // import './FaqItem.scss'
6
6
 
7
- export const FaqItem: React.FC<FaqItemProps> = ({ slug, title, children, index }) => {
8
- const [isOpen, setIsOpen] = React.useState<boolean>(index === 0)
7
+ export const FaqItem: React.FC<FaqItemProps> = ({ slug, title, children }) => {
8
+ const [isOpen, setIsOpen] = React.useState<boolean>(false)
9
9
 
10
10
  return (
11
- <article className={`faqItem ${isOpen ? '' : 'open'}`}>
11
+ <article className={`faqItem ${isOpen ? 'open' : ''}`}>
12
12
  <div id={slug} className='fakeAnchor'></div>
13
13
  <details
14
14
  itemProp='mainEntity'
15
15
  itemScope
16
16
  itemType='https://www.schema.org/Question'
17
17
  className='content'
18
- open={index === 0 ? true : false}
18
+ open={isOpen}
19
19
  >
20
20
  <summary
21
21
  role='button'
22
- tabIndex={index === 0 ? 0 : -1}
23
- onClick={() => {
22
+ tabIndex={isOpen ? 0 : -1}
23
+ onClick={(e) => {
24
+ e.preventDefault()
24
25
  setIsOpen(!isOpen)
25
26
  }}
26
27
  onKeyUp={() => {
@@ -28,7 +29,7 @@ export const FaqItem: React.FC<FaqItemProps> = ({ slug, title, children, index }
28
29
  }}
29
30
  className='question'
30
31
  >
31
- <h3 tabIndex={index === 0 ? 0 : -1} itemProp='name' className='title'>
32
+ <h3 itemProp='name' className='title'>
32
33
  {title}
33
34
  </h3>
34
35
  <ChevronRight24px />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-lib-components",
3
- "version": "5.7.6",
3
+ "version": "5.7.8",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",