@npm_leadtech/legal-lib-components 7.77.0 → 7.78.1

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.
@@ -93,7 +93,7 @@ html {
93
93
  --box-shadow-container: 0px 2px 6px 0px rgba(var(--primary-main-dark-1-rgb), 0.25);
94
94
  --global-gap: 1rem;
95
95
  }
96
- html[data-theme=legalfinity] {
96
+ html[data-theme=primaryblue] {
97
97
  --font-sans: "Poppins", sans-serif;
98
98
  --font-serif: "Poppins", serif;
99
99
  --s-border-radius: 0.25rem;
@@ -278,7 +278,7 @@ html {
278
278
  --font-main: "Inter", sans-serif;
279
279
  --font-secondary: "Lora", serif;
280
280
  }
281
- html[data-theme=districtlaws] {
281
+ html[data-theme=secondaryorange] {
282
282
  --primary-main-light-6: #fff5ee;
283
283
  --primary-main-light-5: #ffe1cc;
284
284
  --primary-main-light-4: #ffc59b;
@@ -316,7 +316,7 @@ html[data-theme=districtlaws] {
316
316
  --font-main: "Inter", sans-serif;
317
317
  --font-secondary: "Lora", serif;
318
318
  }
319
- html[data-theme=lawdistricts] {
319
+ html[data-theme=secondaryblue] {
320
320
  --primary-main-light-6: #f9f9ff;
321
321
  --primary-main-light-5: #eceeff;
322
322
  --primary-main-light-4: #c3c9ff;
@@ -354,7 +354,7 @@ html[data-theme=lawdistricts] {
354
354
  --font-main: "Inter", sans-serif;
355
355
  --font-secondary: "Lora", serif;
356
356
  }
357
- html[data-theme=lawdistrict] {
357
+ html[data-theme=primarygreen] {
358
358
  --primary-main-light-6: #eff7f5;
359
359
  --primary-main-light-5: #e4f8f3;
360
360
  --primary-main-light-4: #c0f7e8;
@@ -392,23 +392,23 @@ html[data-theme=lawdistrict] {
392
392
  --font-main: "Inter", sans-serif;
393
393
  --font-secondary: "Lora", serif;
394
394
  }
395
- html[data-theme=lawdistrict] .document-status.--in-progress {
395
+ html[data-theme=primarygreen] .document-status.--in-progress {
396
396
  background-color: var(--secondary-main-light-4);
397
397
  border-color: var(--secondary-main-dark-1);
398
398
  color: var(--secondary-main-dark-2);
399
399
  }
400
- html[data-theme=lawdistrict] .document-status.--in-progress svg g > g {
400
+ html[data-theme=primarygreen] .document-status.--in-progress svg g > g {
401
401
  fill: var(--secondary-main-dark-2);
402
402
  }
403
- html[data-theme=lawdistrict] .document-status.--is-new {
403
+ html[data-theme=primarygreen] .document-status.--is-new {
404
404
  background-color: var(--secondary-main-dark-2);
405
405
  border-color: var(--secondary-main);
406
406
  color: var(--secondary-main-light-4);
407
407
  }
408
- html[data-theme=lawdistrict] .document-status.--is-new .icon {
408
+ html[data-theme=primarygreen] .document-status.--is-new .icon {
409
409
  margin-right: 1.4rem;
410
410
  }
411
- html[data-theme=lawsdistrict] {
411
+ html[data-theme=secondarypurple] {
412
412
  --primary-main-light-6: #f9f5ff;
413
413
  --primary-main-light-5: #e3d1ff;
414
414
  --primary-main-light-4: #b68aff;
@@ -446,7 +446,7 @@ html[data-theme=lawsdistrict] {
446
446
  --font-main: "Inter", sans-serif;
447
447
  --font-secondary: "Lora", serif;
448
448
  }
449
- html[data-theme=lawdistrictinfo] {
449
+ html[data-theme=secondarygreen] {
450
450
  --primary-main-light-6: #f1fff7;
451
451
  --primary-main-light-5: #d5ffe6;
452
452
  --primary-main-light-4: #6affa5;
@@ -484,7 +484,7 @@ html[data-theme=lawdistrictinfo] {
484
484
  --font-main: "Inter", sans-serif;
485
485
  --font-secondary: "Lora", serif;
486
486
  }
487
- html[data-theme=uslawdistrict] {
487
+ html[data-theme=secondarybrown] {
488
488
  --primary-main-light-6: #fffbf2;
489
489
  --primary-main-light-5: #fff6e5;
490
490
  --primary-main-light-4: #ffe6b7;
@@ -522,7 +522,7 @@ html[data-theme=uslawdistrict] {
522
522
  --font-main: "Inter", sans-serif;
523
523
  --font-secondary: "Lora", serif;
524
524
  }
525
- html[data-theme=lawdistrictonline] {
525
+ html[data-theme=secondaryyellow] {
526
526
  --primary-main-light-6: #f9ffea;
527
527
  --primary-main-light-5: #f0ffc4;
528
528
  --primary-main-light-4: #e6ff9f;
@@ -560,7 +560,7 @@ html[data-theme=lawdistrictonline] {
560
560
  --font-main: "Inter", sans-serif;
561
561
  --font-secondary: "Lora", serif;
562
562
  }
563
- html[data-theme=legalfinity] {
563
+ html[data-theme=primaryblue] {
564
564
  --button: #1039f5;
565
565
  --button-secondary: #1039f5;
566
566
  --button-hover: #3970ff;
@@ -859,7 +859,7 @@ body {
859
859
  .serif.--normal-weight {
860
860
  font-weight: normal;
861
861
  }
862
- html[data-theme=lawdistrict] .e-button.--primary-3 {
862
+ html[data-theme=primarygreen] .e-button.--primary-3 {
863
863
  color: var(--neutral-main);
864
864
  }
865
865
  .e-button {
@@ -1,7 +1,7 @@
1
1
  @import '../../../globalStyles/variables.scss';
2
2
  @import '../../../globalStyles/mediaqueries.scss';
3
3
 
4
- html[data-theme='lawdistrict'] {
4
+ html[data-theme='primarygreen'] {
5
5
  .e-button {
6
6
  &.--primary {
7
7
  &-3 {
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { type AccordionItemProps } from './AccordionItemProps.types';
3
- export declare const AccordionItem: ({ accordionRightContent, children, defaultHeightItem, index, isOpen, onClick, title }: AccordionItemProps) => React.JSX.Element;
3
+ export declare const AccordionItem: ({ accordionRightContent, children, defaultHeightItem, index, isOpen, onClick, title, heightAutoChange }: AccordionItemProps) => React.JSX.Element;
@@ -1,21 +1,41 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* eslint-disable @typescript-eslint/no-unused-expressions */
3
- import { useEffect, useRef } from 'react';
3
+ import React, { useEffect, useRef } from 'react';
4
4
  import { useDispatchDataAccordionItem, useStateDataAccordionItem } from '../../organisms/Accordion/Accordion.context';
5
5
  import { AccordionItemStyled } from './AccordionItem.styled';
6
- export const AccordionItem = ({ accordionRightContent, children, defaultHeightItem = 416, index, isOpen, onClick, title }) => {
6
+ export const AccordionItem = ({ accordionRightContent, children, defaultHeightItem = 416, index, isOpen, onClick, title, heightAutoChange = false }) => {
7
7
  const contenReftHeight = useRef(null);
8
8
  const { state } = useStateDataAccordionItem(index);
9
9
  const { dispatch } = useDispatchDataAccordionItem();
10
+ const [heightAccordionItem, setHeightAccordionItem] = React.useState(defaultHeightItem);
10
11
  useEffect(() => {
11
12
  if (state.locked.actionType === 'unlocked') {
12
13
  onClick();
13
14
  dispatch({ type: 'unlocked', accordionItem: index, resetAction: 'default' });
14
15
  }
15
16
  }, [state.locked.actionType]);
17
+ useEffect(() => {
18
+ let intervalId;
19
+ if (heightAutoChange) {
20
+ intervalId = setInterval(() => {
21
+ const height = contenReftHeight.current?.children[0].getBoundingClientRect().height ?? defaultHeightItem;
22
+ if (heightAccordionItem !== height) {
23
+ setHeightAccordionItem(height);
24
+ }
25
+ }, 500);
26
+ }
27
+ else {
28
+ setHeightAccordionItem(contenReftHeight?.current?.scrollHeight ?? defaultHeightItem);
29
+ }
30
+ return () => {
31
+ if (intervalId !== undefined) {
32
+ clearInterval(intervalId);
33
+ }
34
+ };
35
+ }, []);
16
36
  return (_jsxs(AccordionItemStyled, { className: 'accordion__container', children: [_jsxs("button", { className: `accordion__button
17
37
  ${state.handler === 'success' ? '--success' : ''}
18
38
  ${state.locked.isLocked ? '--locked' : ''}`, onClick: () => {
19
39
  !state.locked.isLocked && onClick();
20
- }, children: [_jsx("p", { className: `accordion__title ${state.locked.isLocked ? '--locked' : ''}`, children: title }), accordionRightContent] }), _jsx("div", { ref: contenReftHeight, className: `accordion__content ${!isOpen ? '--closed' : ''}`, style: isOpen ? { height: contenReftHeight?.current?.scrollHeight ?? defaultHeightItem } : { height: '0px' }, children: children })] }));
40
+ }, children: [_jsx("p", { className: `accordion__title ${state.locked.isLocked ? '--locked' : ''}`, children: title }), accordionRightContent] }), _jsx("div", { ref: contenReftHeight, className: `accordion__content ${!isOpen ? '--closed' : ''}`, style: isOpen ? { height: heightAccordionItem } : { height: '0px' }, children: children })] }));
21
41
  };
@@ -56,7 +56,7 @@ export const AccordionItemStyled = styled.div `
56
56
  &.--locked {
57
57
  color: var(--neutral-neutral-2);
58
58
 
59
- html[data-theme='legalfinity'] & {
59
+ html[data-theme='primaryblue'] & {
60
60
  color: var(--primary-main-dark-1);
61
61
  }
62
62
  }
@@ -57,7 +57,7 @@ export const AccordionItemStyled = styled.div`
57
57
  &.--locked {
58
58
  color: var(--neutral-neutral-2);
59
59
 
60
- html[data-theme='legalfinity'] & {
60
+ html[data-theme='primaryblue'] & {
61
61
  color: var(--primary-main-dark-1);
62
62
  }
63
63
  }
@@ -12,11 +12,13 @@ export const AccordionItem = ({
12
12
  index,
13
13
  isOpen,
14
14
  onClick,
15
- title
15
+ title,
16
+ heightAutoChange = false
16
17
  }: AccordionItemProps): React.JSX.Element => {
17
18
  const contenReftHeight = useRef<HTMLInputElement>(null)
18
19
  const { state } = useStateDataAccordionItem(index)
19
20
  const { dispatch } = useDispatchDataAccordionItem()
21
+ const [heightAccordionItem, setHeightAccordionItem] = React.useState<number>(defaultHeightItem)
20
22
 
21
23
  useEffect(() => {
22
24
  if (state.locked.actionType === 'unlocked') {
@@ -25,6 +27,25 @@ export const AccordionItem = ({
25
27
  }
26
28
  }, [state.locked.actionType])
27
29
 
30
+ useEffect(() => {
31
+ let intervalId: ReturnType<typeof setInterval> | undefined
32
+ if (heightAutoChange) {
33
+ intervalId = setInterval(() => {
34
+ const height = contenReftHeight.current?.children[0].getBoundingClientRect().height ?? defaultHeightItem
35
+ if (heightAccordionItem !== height) {
36
+ setHeightAccordionItem(height)
37
+ }
38
+ }, 500)
39
+ } else {
40
+ setHeightAccordionItem(contenReftHeight?.current?.scrollHeight ?? defaultHeightItem)
41
+ }
42
+ return () => {
43
+ if (intervalId !== undefined) {
44
+ clearInterval(intervalId)
45
+ }
46
+ }
47
+ }, [])
48
+
28
49
  return (
29
50
  <AccordionItemStyled className='accordion__container'>
30
51
  <button
@@ -42,7 +63,7 @@ export const AccordionItem = ({
42
63
  <div
43
64
  ref={contenReftHeight}
44
65
  className={`accordion__content ${!isOpen ? '--closed' : ''}`}
45
- style={isOpen ? { height: contenReftHeight?.current?.scrollHeight ?? defaultHeightItem } : { height: '0px' }}
66
+ style={isOpen ? { height: heightAccordionItem } : { height: '0px' }}
46
67
  >
47
68
  {children}
48
69
  </div>
@@ -6,4 +6,5 @@ export interface AccordionItemProps {
6
6
  isOpen?: boolean;
7
7
  onClick: () => void;
8
8
  title?: string;
9
+ heightAutoChange?: boolean;
9
10
  }
@@ -6,4 +6,5 @@ export interface AccordionItemProps {
6
6
  isOpen?: boolean
7
7
  onClick: () => void
8
8
  title?: string
9
+ heightAutoChange?: boolean
9
10
  }
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { type AccordionProps } from './AccordionProps.types';
3
- export declare const Accordion: ({ data, defaultActiveIndex, defaultHeightItem }: AccordionProps) => React.JSX.Element;
3
+ export declare const Accordion: ({ data, defaultActiveIndex, defaultHeightItem, heightAutoChange }: AccordionProps) => React.JSX.Element;
@@ -3,12 +3,12 @@ import { useState } from 'react';
3
3
  import { AccordionItem } from '../../molecules';
4
4
  import { AccordionProvider } from './Accordion.context';
5
5
  import { AccordionStyled } from './Accordion.styled';
6
- export const Accordion = ({ data, defaultActiveIndex = 0, defaultHeightItem }) => {
6
+ export const Accordion = ({ data, defaultActiveIndex = 0, defaultHeightItem, heightAutoChange = false }) => {
7
7
  const [activeIndex, setActiveIndex] = useState(defaultActiveIndex);
8
8
  const handleItemClick = (index) => {
9
9
  setActiveIndex((prevIndex) => (prevIndex === index ? -1 : index));
10
10
  };
11
11
  return (_jsx(AccordionProvider, { elements: data.length, children: _jsx(AccordionStyled, { children: data.map((item, index) => (_jsx(AccordionItem, { accordionRightContent: item?.accordionRightContent, defaultHeightItem: defaultHeightItem, index: index, isOpen: activeIndex === index, onClick: () => {
12
12
  handleItemClick(index);
13
- }, title: item.title, children: item.children }, index))) }) }));
13
+ }, title: item.title, heightAutoChange: heightAutoChange, children: item.children }, index))) }) }));
14
14
  };
@@ -4,7 +4,12 @@ import { type AccordionProps } from './AccordionProps.types'
4
4
  import { AccordionProvider } from './Accordion.context'
5
5
  import { AccordionStyled } from './Accordion.styled'
6
6
 
7
- export const Accordion = ({ data, defaultActiveIndex = 0, defaultHeightItem }: AccordionProps): React.JSX.Element => {
7
+ export const Accordion = ({
8
+ data,
9
+ defaultActiveIndex = 0,
10
+ defaultHeightItem,
11
+ heightAutoChange = false
12
+ }: AccordionProps): React.JSX.Element => {
8
13
  const [activeIndex, setActiveIndex] = useState(defaultActiveIndex)
9
14
 
10
15
  const handleItemClick = (index: number): void => {
@@ -25,6 +30,7 @@ export const Accordion = ({ data, defaultActiveIndex = 0, defaultHeightItem }: A
25
30
  handleItemClick(index)
26
31
  }}
27
32
  title={item.title}
33
+ heightAutoChange={heightAutoChange}
28
34
  >
29
35
  {item.children}
30
36
  </AccordionItem>
@@ -8,5 +8,6 @@ export interface AccordionProps {
8
8
  data: AccordionItem[];
9
9
  defaultActiveIndex?: number;
10
10
  defaultHeightItem?: number;
11
+ heightAutoChange?: boolean;
11
12
  }
12
13
  export {};
@@ -9,4 +9,5 @@ export interface AccordionProps {
9
9
  data: AccordionItem[]
10
10
  defaultActiveIndex?: number
11
11
  defaultHeightItem?: number
12
+ heightAutoChange?: boolean
12
13
  }
@@ -13,7 +13,7 @@ export const HeaderStyled = styled.header `
13
13
  z-index: 111111111111;
14
14
  }
15
15
 
16
- html[data-theme='lawdistrict'] {
16
+ html[data-theme='primarygreen'] {
17
17
  .header {
18
18
  &.product-header-background {
19
19
  background-color: var(--secondary-main-light-4);
@@ -14,7 +14,7 @@ export const HeaderStyled = styled.header`
14
14
  z-index: 111111111111;
15
15
  }
16
16
 
17
- html[data-theme='lawdistrict'] {
17
+ html[data-theme='primarygreen'] {
18
18
  .header {
19
19
  &.product-header-background {
20
20
  background-color: var(--secondary-main-light-4);
@@ -57,7 +57,7 @@ html {
57
57
  --font-secondary: 'Lora', serif;
58
58
  }
59
59
 
60
- html[data-theme='districtlaws'] {
60
+ html[data-theme='secondaryorange'] {
61
61
  --primary-main-light-6: #fff5ee;
62
62
  --primary-main-light-5: #ffe1cc;
63
63
  --primary-main-light-4: #ffc59b;
@@ -94,7 +94,7 @@ html[data-theme='districtlaws'] {
94
94
  --font-secondary: 'Lora', serif;
95
95
  }
96
96
 
97
- html[data-theme='lawdistricts'] {
97
+ html[data-theme='secondaryblue'] {
98
98
  --primary-main-light-6: #f9f9ff;
99
99
  --primary-main-light-5: #eceeff;
100
100
  --primary-main-light-4: #c3c9ff;
@@ -131,7 +131,7 @@ html[data-theme='lawdistricts'] {
131
131
  --font-secondary: 'Lora', serif;
132
132
  }
133
133
 
134
- html[data-theme='lawdistrict'] {
134
+ html[data-theme='primarygreen'] {
135
135
  --primary-main-light-6: #eff7f5;
136
136
  --primary-main-light-5: #e4f8f3;
137
137
  --primary-main-light-4: #c0f7e8;
@@ -168,7 +168,7 @@ html[data-theme='lawdistrict'] {
168
168
  --font-secondary: 'Lora', serif;
169
169
  }
170
170
 
171
- html[data-theme='lawdistrict'] {
171
+ html[data-theme='primarygreen'] {
172
172
  .document-status {
173
173
  &.--in-progress {
174
174
  background-color: var(--secondary-main-light-4);
@@ -194,7 +194,7 @@ html[data-theme='lawdistrict'] {
194
194
  }
195
195
  }
196
196
 
197
- html[data-theme='lawsdistrict'] {
197
+ html[data-theme='secondarypurple'] {
198
198
  --primary-main-light-6: #f9f5ff;
199
199
  --primary-main-light-5: #e3d1ff;
200
200
  --primary-main-light-4: #b68aff;
@@ -231,7 +231,7 @@ html[data-theme='lawsdistrict'] {
231
231
  --font-secondary: 'Lora', serif;
232
232
  }
233
233
 
234
- html[data-theme='lawdistrictinfo'] {
234
+ html[data-theme='secondarygreen'] {
235
235
  --primary-main-light-6: #f1fff7;
236
236
  --primary-main-light-5: #d5ffe6;
237
237
  --primary-main-light-4: #6affa5;
@@ -268,7 +268,7 @@ html[data-theme='lawdistrictinfo'] {
268
268
  --font-secondary: 'Lora', serif;
269
269
  }
270
270
 
271
- html[data-theme='uslawdistrict'] {
271
+ html[data-theme='secondarybrown'] {
272
272
  --primary-main-light-6: #fffbf2;
273
273
  --primary-main-light-5: #fff6e5;
274
274
  --primary-main-light-4: #ffe6b7;
@@ -305,7 +305,7 @@ html[data-theme='uslawdistrict'] {
305
305
  --font-secondary: 'Lora', serif;
306
306
  }
307
307
 
308
- html[data-theme='lawdistrictonline'] {
308
+ html[data-theme='secondaryyellow'] {
309
309
  --primary-main-light-6: #f9ffea;
310
310
  --primary-main-light-5: #f0ffc4;
311
311
  --primary-main-light-4: #e6ff9f;
@@ -342,7 +342,7 @@ html[data-theme='lawdistrictonline'] {
342
342
  --font-secondary: 'Lora', serif;
343
343
  }
344
344
 
345
- html[data-theme='legalfinity'] {
345
+ html[data-theme='primaryblue'] {
346
346
  --button: #1039f5;
347
347
  --button-secondary: #1039f5;
348
348
  --button-hover: #3970ff;
@@ -15,7 +15,7 @@ html {
15
15
  --global-gap: 1rem;
16
16
  }
17
17
 
18
- html[data-theme='legalfinity'] {
18
+ html[data-theme='primaryblue'] {
19
19
  --font-sans: 'Poppins', sans-serif;
20
20
  --font-serif: 'Poppins', serif;
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-lib-components",
3
- "version": "7.77.0",
3
+ "version": "7.78.1",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",