@lidofinance/lido-ui 3.42.0 → 3.42.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.
@@ -2,34 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const React = require('react');
6
- const _useCollapse = require('react-collapsed');
5
+ const reactCollapsed = require('react-collapsed');
7
6
 
8
- //@ts-expect-error Property default doesn't exist on type
9
- const useCollapse = _useCollapse.default || _useCollapse;
10
7
  const useExpanded = _ref => {
11
8
  let {
12
9
  defaultExpanded = false,
13
10
  onExpand,
14
11
  onCollapse
15
12
  } = _ref;
16
- const [isExpanded, setExpanded] = React.useState(defaultExpanded);
17
- React.useEffect(() => {
18
- setExpanded(defaultExpanded);
19
- }, [defaultExpanded]);
20
- const handleToggle = React.useCallback(() => setExpanded(previous => !previous), []);
21
13
  const {
22
14
  getToggleProps,
23
- getCollapseProps
24
- } = useCollapse({
25
- isExpanded,
26
- onExpandEnd: onExpand,
27
- onCollapseEnd: onCollapse
15
+ getCollapseProps,
16
+ isExpanded
17
+ } = reactCollapsed.useCollapse({
18
+ defaultExpanded,
19
+ onTransitionStateChange: state => {
20
+ if (state === 'expandEnd') onExpand?.();
21
+ if (state === 'collapseEnd') onCollapse?.();
22
+ }
28
23
  });
29
24
  return {
30
- toggleProps: getToggleProps({
31
- onClick: handleToggle
32
- }),
25
+ toggleProps: getToggleProps(),
33
26
  collapseProps: getCollapseProps(),
34
27
  isExpanded
35
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useExpanded.js","sources":["../../../packages/accordion/useExpanded.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport { AccordionProps } from './types.js'\nimport _useCollapse from 'react-collapsed'\nimport {\n GetCollapsePropsOutput,\n GetTogglePropsOutput,\n} from 'react-collapsed/dist/types.js'\n\n//@ts-expect-error Property default doesn't exist on type\nconst useCollapse: typeof _useCollapse = _useCollapse.default || _useCollapse\n\ntype UseExpanded = (\n props: Pick<AccordionProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>,\n) => {\n toggleProps: GetTogglePropsOutput\n collapseProps: GetCollapsePropsOutput\n isExpanded: boolean\n}\n\nexport const useExpanded: UseExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}) => {\n const [isExpanded, setExpanded] = useState(defaultExpanded)\n\n useEffect(() => {\n setExpanded(defaultExpanded)\n }, [defaultExpanded])\n\n const handleToggle = useCallback(\n () => setExpanded((previous) => !previous),\n [],\n )\n\n const { getToggleProps, getCollapseProps } = useCollapse({\n isExpanded,\n onExpandEnd: onExpand,\n onCollapseEnd: onCollapse,\n })\n\n return {\n toggleProps: getToggleProps({ onClick: handleToggle }),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useCollapse","_useCollapse","default","useExpanded","_ref","defaultExpanded","onExpand","onCollapse","isExpanded","setExpanded","useState","useEffect","handleToggle","useCallback","previous","getToggleProps","getCollapseProps","onExpandEnd","onCollapseEnd","toggleProps","onClick","collapseProps"],"mappings":";;;;;;;AAQA;AACA,MAAMA,WAAgC,GAAGC,YAAY,CAACC,OAAO,IAAID,YAAY,CAAA;AAUhEE,MAAAA,WAAwB,GAAGC,IAAA,IAIlC;EAAA,IAJmC;AACvCC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AACF,GAAC,GAAAH,IAAA,CAAA;EACC,MAAM,CAACI,UAAU,EAAEC,WAAW,CAAC,GAAGC,cAAQ,CAACL,eAAe,CAAC,CAAA;AAE3DM,EAAAA,eAAS,CAAC,MAAM;IACdF,WAAW,CAACJ,eAAe,CAAC,CAAA;AAC9B,GAAC,EAAE,CAACA,eAAe,CAAC,CAAC,CAAA;AAErB,EAAA,MAAMO,YAAY,GAAGC,iBAAW,CAC9B,MAAMJ,WAAW,CAAEK,QAAQ,IAAK,CAACA,QAAQ,CAAC,EAC1C,EACF,CAAC,CAAA;EAED,MAAM;IAAEC,cAAc;AAAEC,IAAAA,gBAAAA;GAAkB,GAAGhB,WAAW,CAAC;IACvDQ,UAAU;AACVS,IAAAA,WAAW,EAAEX,QAAQ;AACrBY,IAAAA,aAAa,EAAEX,UAAAA;AACjB,GAAC,CAAC,CAAA;EAEF,OAAO;IACLY,WAAW,EAAEJ,cAAc,CAAC;AAAEK,MAAAA,OAAO,EAAER,YAAAA;AAAa,KAAC,CAAC;IACtDS,aAAa,EAAEL,gBAAgB,EAAE;AACjCR,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useExpanded.js","sources":["../../../packages/accordion/useExpanded.ts"],"sourcesContent":["import { useCollapse } from 'react-collapsed'\nimport { AccordionProps } from './types.js'\n\nexport const useExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}: Pick<AccordionProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>) => {\n const { getToggleProps, getCollapseProps, isExpanded } = useCollapse({\n defaultExpanded,\n onTransitionStateChange: (state) => {\n if (state === 'expandEnd') onExpand?.()\n if (state === 'collapseEnd') onCollapse?.()\n },\n })\n\n return {\n toggleProps: getToggleProps(),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useExpanded","_ref","defaultExpanded","onExpand","onCollapse","getToggleProps","getCollapseProps","isExpanded","useCollapse","onTransitionStateChange","state","toggleProps","collapseProps"],"mappings":";;;;;;AAGaA,MAAAA,WAAW,GAAGC,IAAA,IAIgD;EAAA,IAJ/C;AAC1BC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AACmE,GAAC,GAAAH,IAAA,CAAA;EACpE,MAAM;IAAEI,cAAc;IAAEC,gBAAgB;AAAEC,IAAAA,UAAAA;GAAY,GAAGC,0BAAW,CAAC;IACnEN,eAAe;IACfO,uBAAuB,EAAGC,KAAK,IAAK;AAClC,MAAA,IAAIA,KAAK,KAAK,WAAW,EAAEP,QAAQ,IAAI,CAAA;AACvC,MAAA,IAAIO,KAAK,KAAK,aAAa,EAAEN,UAAU,IAAI,CAAA;AAC7C,KAAA;AACF,GAAC,CAAC,CAAA;EAEF,OAAO;IACLO,WAAW,EAAEN,cAAc,EAAE;IAC7BO,aAAa,EAAEN,gBAAgB,EAAE;AACjCC,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
@@ -2,34 +2,27 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const React = require('react');
6
- const _useCollapse = require('react-collapsed');
5
+ const reactCollapsed = require('react-collapsed');
7
6
 
8
- //@ts-expect-error Property default doesn't exist on type
9
- const useCollapse = _useCollapse.default || _useCollapse;
10
7
  const useExpanded = _ref => {
11
8
  let {
12
9
  defaultExpanded = false,
13
10
  onExpand,
14
11
  onCollapse
15
12
  } = _ref;
16
- const [isExpanded, setExpanded] = React.useState(defaultExpanded);
17
- React.useEffect(() => {
18
- setExpanded(defaultExpanded);
19
- }, [defaultExpanded]);
20
- const handleToggle = React.useCallback(() => setExpanded(previous => !previous), []);
21
13
  const {
22
14
  getToggleProps,
23
- getCollapseProps
24
- } = useCollapse({
25
- isExpanded,
26
- onExpandEnd: onExpand,
27
- onCollapseEnd: onCollapse
15
+ getCollapseProps,
16
+ isExpanded
17
+ } = reactCollapsed.useCollapse({
18
+ defaultExpanded,
19
+ onTransitionStateChange: state => {
20
+ if (state === 'expandEnd') onExpand?.();
21
+ if (state === 'collapseEnd') onCollapse?.();
22
+ }
28
23
  });
29
24
  return {
30
- toggleProps: getToggleProps({
31
- onClick: handleToggle
32
- }),
25
+ toggleProps: getToggleProps(),
33
26
  collapseProps: getCollapseProps(),
34
27
  isExpanded
35
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useExpanded.js","sources":["../../../packages/accordion-transparent/useExpanded.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport { AccordionTransparentProps } from './types.js'\nimport _useCollapse from 'react-collapsed'\nimport {\n GetCollapsePropsOutput,\n GetTogglePropsOutput,\n} from 'react-collapsed/dist/types.js'\n\n//@ts-expect-error Property default doesn't exist on type\nconst useCollapse: typeof _useCollapse = _useCollapse.default || _useCollapse\n\ntype UseExpanded = (\n props: Pick<\n AccordionTransparentProps,\n 'defaultExpanded' | 'onExpand' | 'onCollapse'\n >,\n) => {\n toggleProps: GetTogglePropsOutput\n collapseProps: GetCollapsePropsOutput\n isExpanded: boolean\n}\n\nexport const useExpanded: UseExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}) => {\n const [isExpanded, setExpanded] = useState(defaultExpanded)\n\n useEffect(() => {\n setExpanded(defaultExpanded)\n }, [defaultExpanded])\n\n const handleToggle = useCallback(\n () => setExpanded((previous) => !previous),\n [],\n )\n\n const { getToggleProps, getCollapseProps } = useCollapse({\n isExpanded,\n onExpandEnd: onExpand,\n onCollapseEnd: onCollapse,\n })\n\n return {\n toggleProps: getToggleProps({ onClick: handleToggle }),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useCollapse","_useCollapse","default","useExpanded","_ref","defaultExpanded","onExpand","onCollapse","isExpanded","setExpanded","useState","useEffect","handleToggle","useCallback","previous","getToggleProps","getCollapseProps","onExpandEnd","onCollapseEnd","toggleProps","onClick","collapseProps"],"mappings":";;;;;;;AAQA;AACA,MAAMA,WAAgC,GAAGC,YAAY,CAACC,OAAO,IAAID,YAAY,CAAA;AAahEE,MAAAA,WAAwB,GAAGC,IAAA,IAIlC;EAAA,IAJmC;AACvCC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AACF,GAAC,GAAAH,IAAA,CAAA;EACC,MAAM,CAACI,UAAU,EAAEC,WAAW,CAAC,GAAGC,cAAQ,CAACL,eAAe,CAAC,CAAA;AAE3DM,EAAAA,eAAS,CAAC,MAAM;IACdF,WAAW,CAACJ,eAAe,CAAC,CAAA;AAC9B,GAAC,EAAE,CAACA,eAAe,CAAC,CAAC,CAAA;AAErB,EAAA,MAAMO,YAAY,GAAGC,iBAAW,CAC9B,MAAMJ,WAAW,CAAEK,QAAQ,IAAK,CAACA,QAAQ,CAAC,EAC1C,EACF,CAAC,CAAA;EAED,MAAM;IAAEC,cAAc;AAAEC,IAAAA,gBAAAA;GAAkB,GAAGhB,WAAW,CAAC;IACvDQ,UAAU;AACVS,IAAAA,WAAW,EAAEX,QAAQ;AACrBY,IAAAA,aAAa,EAAEX,UAAAA;AACjB,GAAC,CAAC,CAAA;EAEF,OAAO;IACLY,WAAW,EAAEJ,cAAc,CAAC;AAAEK,MAAAA,OAAO,EAAER,YAAAA;AAAa,KAAC,CAAC;IACtDS,aAAa,EAAEL,gBAAgB,EAAE;AACjCR,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useExpanded.js","sources":["../../../packages/accordion-transparent/useExpanded.ts"],"sourcesContent":["import { useCollapse } from 'react-collapsed'\nimport { AccordionTransparentProps } from './types.js'\n\nexport const useExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}: Pick<\n AccordionTransparentProps,\n 'defaultExpanded' | 'onExpand' | 'onCollapse'\n>) => {\n const { getToggleProps, getCollapseProps, isExpanded } = useCollapse({\n defaultExpanded,\n onTransitionStateChange: (state) => {\n if (state === 'expandEnd') onExpand?.()\n if (state === 'collapseEnd') onCollapse?.()\n },\n })\n\n return {\n toggleProps: getToggleProps(),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useExpanded","_ref","defaultExpanded","onExpand","onCollapse","getToggleProps","getCollapseProps","isExpanded","useCollapse","onTransitionStateChange","state","toggleProps","collapseProps"],"mappings":";;;;;;AAGaA,MAAAA,WAAW,GAAGC,IAAA,IAOrB;EAAA,IAPsB;AAC1BC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AAIF,GAAC,GAAAH,IAAA,CAAA;EACC,MAAM;IAAEI,cAAc;IAAEC,gBAAgB;AAAEC,IAAAA,UAAAA;GAAY,GAAGC,0BAAW,CAAC;IACnEN,eAAe;IACfO,uBAAuB,EAAGC,KAAK,IAAK;AAClC,MAAA,IAAIA,KAAK,KAAK,WAAW,EAAEP,QAAQ,IAAI,CAAA;AACvC,MAAA,IAAIO,KAAK,KAAK,aAAa,EAAEN,UAAU,IAAI,CAAA;AAC7C,KAAA;AACF,GAAC,CAAC,CAAA;EAEF,OAAO;IACLO,WAAW,EAAEN,cAAc,EAAE;IAC7BO,aAAa,EAAEN,gBAAgB,EAAE;AACjCC,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
@@ -1,31 +1,24 @@
1
- import { useState, useEffect, useCallback } from 'react';
2
- import _useCollapse from 'react-collapsed';
1
+ import { useCollapse } from 'react-collapsed';
3
2
 
4
- //@ts-expect-error Property default doesn't exist on type
5
- const useCollapse = _useCollapse.default || _useCollapse;
6
3
  const useExpanded = _ref => {
7
4
  let {
8
5
  defaultExpanded = false,
9
6
  onExpand,
10
7
  onCollapse
11
8
  } = _ref;
12
- const [isExpanded, setExpanded] = useState(defaultExpanded);
13
- useEffect(() => {
14
- setExpanded(defaultExpanded);
15
- }, [defaultExpanded]);
16
- const handleToggle = useCallback(() => setExpanded(previous => !previous), []);
17
9
  const {
18
10
  getToggleProps,
19
- getCollapseProps
11
+ getCollapseProps,
12
+ isExpanded
20
13
  } = useCollapse({
21
- isExpanded,
22
- onExpandEnd: onExpand,
23
- onCollapseEnd: onCollapse
14
+ defaultExpanded,
15
+ onTransitionStateChange: state => {
16
+ if (state === 'expandEnd') onExpand?.();
17
+ if (state === 'collapseEnd') onCollapse?.();
18
+ }
24
19
  });
25
20
  return {
26
- toggleProps: getToggleProps({
27
- onClick: handleToggle
28
- }),
21
+ toggleProps: getToggleProps(),
29
22
  collapseProps: getCollapseProps(),
30
23
  isExpanded
31
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useExpanded.mjs","sources":["../../../packages/accordion/useExpanded.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport { AccordionProps } from './types.js'\nimport _useCollapse from 'react-collapsed'\nimport {\n GetCollapsePropsOutput,\n GetTogglePropsOutput,\n} from 'react-collapsed/dist/types.js'\n\n//@ts-expect-error Property default doesn't exist on type\nconst useCollapse: typeof _useCollapse = _useCollapse.default || _useCollapse\n\ntype UseExpanded = (\n props: Pick<AccordionProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>,\n) => {\n toggleProps: GetTogglePropsOutput\n collapseProps: GetCollapsePropsOutput\n isExpanded: boolean\n}\n\nexport const useExpanded: UseExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}) => {\n const [isExpanded, setExpanded] = useState(defaultExpanded)\n\n useEffect(() => {\n setExpanded(defaultExpanded)\n }, [defaultExpanded])\n\n const handleToggle = useCallback(\n () => setExpanded((previous) => !previous),\n [],\n )\n\n const { getToggleProps, getCollapseProps } = useCollapse({\n isExpanded,\n onExpandEnd: onExpand,\n onCollapseEnd: onCollapse,\n })\n\n return {\n toggleProps: getToggleProps({ onClick: handleToggle }),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useCollapse","_useCollapse","default","useExpanded","_ref","defaultExpanded","onExpand","onCollapse","isExpanded","setExpanded","useState","useEffect","handleToggle","useCallback","previous","getToggleProps","getCollapseProps","onExpandEnd","onCollapseEnd","toggleProps","onClick","collapseProps"],"mappings":";;;AAQA;AACA,MAAMA,WAAgC,GAAGC,YAAY,CAACC,OAAO,IAAID,YAAY,CAAA;AAUhEE,MAAAA,WAAwB,GAAGC,IAAA,IAIlC;EAAA,IAJmC;AACvCC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AACF,GAAC,GAAAH,IAAA,CAAA;EACC,MAAM,CAACI,UAAU,EAAEC,WAAW,CAAC,GAAGC,QAAQ,CAACL,eAAe,CAAC,CAAA;AAE3DM,EAAAA,SAAS,CAAC,MAAM;IACdF,WAAW,CAACJ,eAAe,CAAC,CAAA;AAC9B,GAAC,EAAE,CAACA,eAAe,CAAC,CAAC,CAAA;AAErB,EAAA,MAAMO,YAAY,GAAGC,WAAW,CAC9B,MAAMJ,WAAW,CAAEK,QAAQ,IAAK,CAACA,QAAQ,CAAC,EAC1C,EACF,CAAC,CAAA;EAED,MAAM;IAAEC,cAAc;AAAEC,IAAAA,gBAAAA;GAAkB,GAAGhB,WAAW,CAAC;IACvDQ,UAAU;AACVS,IAAAA,WAAW,EAAEX,QAAQ;AACrBY,IAAAA,aAAa,EAAEX,UAAAA;AACjB,GAAC,CAAC,CAAA;EAEF,OAAO;IACLY,WAAW,EAAEJ,cAAc,CAAC;AAAEK,MAAAA,OAAO,EAAER,YAAAA;AAAa,KAAC,CAAC;IACtDS,aAAa,EAAEL,gBAAgB,EAAE;AACjCR,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useExpanded.mjs","sources":["../../../packages/accordion/useExpanded.ts"],"sourcesContent":["import { useCollapse } from 'react-collapsed'\nimport { AccordionProps } from './types.js'\n\nexport const useExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}: Pick<AccordionProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>) => {\n const { getToggleProps, getCollapseProps, isExpanded } = useCollapse({\n defaultExpanded,\n onTransitionStateChange: (state) => {\n if (state === 'expandEnd') onExpand?.()\n if (state === 'collapseEnd') onCollapse?.()\n },\n })\n\n return {\n toggleProps: getToggleProps(),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useExpanded","_ref","defaultExpanded","onExpand","onCollapse","getToggleProps","getCollapseProps","isExpanded","useCollapse","onTransitionStateChange","state","toggleProps","collapseProps"],"mappings":";;AAGaA,MAAAA,WAAW,GAAGC,IAAA,IAIgD;EAAA,IAJ/C;AAC1BC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AACmE,GAAC,GAAAH,IAAA,CAAA;EACpE,MAAM;IAAEI,cAAc;IAAEC,gBAAgB;AAAEC,IAAAA,UAAAA;GAAY,GAAGC,WAAW,CAAC;IACnEN,eAAe;IACfO,uBAAuB,EAAGC,KAAK,IAAK;AAClC,MAAA,IAAIA,KAAK,KAAK,WAAW,EAAEP,QAAQ,IAAI,CAAA;AACvC,MAAA,IAAIO,KAAK,KAAK,aAAa,EAAEN,UAAU,IAAI,CAAA;AAC7C,KAAA;AACF,GAAC,CAAC,CAAA;EAEF,OAAO;IACLO,WAAW,EAAEN,cAAc,EAAE;IAC7BO,aAAa,EAAEN,gBAAgB,EAAE;AACjCC,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
@@ -1,31 +1,24 @@
1
- import { useState, useEffect, useCallback } from 'react';
2
- import _useCollapse from 'react-collapsed';
1
+ import { useCollapse } from 'react-collapsed';
3
2
 
4
- //@ts-expect-error Property default doesn't exist on type
5
- const useCollapse = _useCollapse.default || _useCollapse;
6
3
  const useExpanded = _ref => {
7
4
  let {
8
5
  defaultExpanded = false,
9
6
  onExpand,
10
7
  onCollapse
11
8
  } = _ref;
12
- const [isExpanded, setExpanded] = useState(defaultExpanded);
13
- useEffect(() => {
14
- setExpanded(defaultExpanded);
15
- }, [defaultExpanded]);
16
- const handleToggle = useCallback(() => setExpanded(previous => !previous), []);
17
9
  const {
18
10
  getToggleProps,
19
- getCollapseProps
11
+ getCollapseProps,
12
+ isExpanded
20
13
  } = useCollapse({
21
- isExpanded,
22
- onExpandEnd: onExpand,
23
- onCollapseEnd: onCollapse
14
+ defaultExpanded,
15
+ onTransitionStateChange: state => {
16
+ if (state === 'expandEnd') onExpand?.();
17
+ if (state === 'collapseEnd') onCollapse?.();
18
+ }
24
19
  });
25
20
  return {
26
- toggleProps: getToggleProps({
27
- onClick: handleToggle
28
- }),
21
+ toggleProps: getToggleProps(),
29
22
  collapseProps: getCollapseProps(),
30
23
  isExpanded
31
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useExpanded.mjs","sources":["../../../packages/accordion-transparent/useExpanded.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport { AccordionTransparentProps } from './types.js'\nimport _useCollapse from 'react-collapsed'\nimport {\n GetCollapsePropsOutput,\n GetTogglePropsOutput,\n} from 'react-collapsed/dist/types.js'\n\n//@ts-expect-error Property default doesn't exist on type\nconst useCollapse: typeof _useCollapse = _useCollapse.default || _useCollapse\n\ntype UseExpanded = (\n props: Pick<\n AccordionTransparentProps,\n 'defaultExpanded' | 'onExpand' | 'onCollapse'\n >,\n) => {\n toggleProps: GetTogglePropsOutput\n collapseProps: GetCollapsePropsOutput\n isExpanded: boolean\n}\n\nexport const useExpanded: UseExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}) => {\n const [isExpanded, setExpanded] = useState(defaultExpanded)\n\n useEffect(() => {\n setExpanded(defaultExpanded)\n }, [defaultExpanded])\n\n const handleToggle = useCallback(\n () => setExpanded((previous) => !previous),\n [],\n )\n\n const { getToggleProps, getCollapseProps } = useCollapse({\n isExpanded,\n onExpandEnd: onExpand,\n onCollapseEnd: onCollapse,\n })\n\n return {\n toggleProps: getToggleProps({ onClick: handleToggle }),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useCollapse","_useCollapse","default","useExpanded","_ref","defaultExpanded","onExpand","onCollapse","isExpanded","setExpanded","useState","useEffect","handleToggle","useCallback","previous","getToggleProps","getCollapseProps","onExpandEnd","onCollapseEnd","toggleProps","onClick","collapseProps"],"mappings":";;;AAQA;AACA,MAAMA,WAAgC,GAAGC,YAAY,CAACC,OAAO,IAAID,YAAY,CAAA;AAahEE,MAAAA,WAAwB,GAAGC,IAAA,IAIlC;EAAA,IAJmC;AACvCC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AACF,GAAC,GAAAH,IAAA,CAAA;EACC,MAAM,CAACI,UAAU,EAAEC,WAAW,CAAC,GAAGC,QAAQ,CAACL,eAAe,CAAC,CAAA;AAE3DM,EAAAA,SAAS,CAAC,MAAM;IACdF,WAAW,CAACJ,eAAe,CAAC,CAAA;AAC9B,GAAC,EAAE,CAACA,eAAe,CAAC,CAAC,CAAA;AAErB,EAAA,MAAMO,YAAY,GAAGC,WAAW,CAC9B,MAAMJ,WAAW,CAAEK,QAAQ,IAAK,CAACA,QAAQ,CAAC,EAC1C,EACF,CAAC,CAAA;EAED,MAAM;IAAEC,cAAc;AAAEC,IAAAA,gBAAAA;GAAkB,GAAGhB,WAAW,CAAC;IACvDQ,UAAU;AACVS,IAAAA,WAAW,EAAEX,QAAQ;AACrBY,IAAAA,aAAa,EAAEX,UAAAA;AACjB,GAAC,CAAC,CAAA;EAEF,OAAO;IACLY,WAAW,EAAEJ,cAAc,CAAC;AAAEK,MAAAA,OAAO,EAAER,YAAAA;AAAa,KAAC,CAAC;IACtDS,aAAa,EAAEL,gBAAgB,EAAE;AACjCR,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useExpanded.mjs","sources":["../../../packages/accordion-transparent/useExpanded.ts"],"sourcesContent":["import { useCollapse } from 'react-collapsed'\nimport { AccordionTransparentProps } from './types.js'\n\nexport const useExpanded = ({\n defaultExpanded = false,\n onExpand,\n onCollapse,\n}: Pick<\n AccordionTransparentProps,\n 'defaultExpanded' | 'onExpand' | 'onCollapse'\n>) => {\n const { getToggleProps, getCollapseProps, isExpanded } = useCollapse({\n defaultExpanded,\n onTransitionStateChange: (state) => {\n if (state === 'expandEnd') onExpand?.()\n if (state === 'collapseEnd') onCollapse?.()\n },\n })\n\n return {\n toggleProps: getToggleProps(),\n collapseProps: getCollapseProps(),\n isExpanded,\n }\n}\n"],"names":["useExpanded","_ref","defaultExpanded","onExpand","onCollapse","getToggleProps","getCollapseProps","isExpanded","useCollapse","onTransitionStateChange","state","toggleProps","collapseProps"],"mappings":";;AAGaA,MAAAA,WAAW,GAAGC,IAAA,IAOrB;EAAA,IAPsB;AAC1BC,IAAAA,eAAe,GAAG,KAAK;IACvBC,QAAQ;AACRC,IAAAA,UAAAA;AAIF,GAAC,GAAAH,IAAA,CAAA;EACC,MAAM;IAAEI,cAAc;IAAEC,gBAAgB;AAAEC,IAAAA,UAAAA;GAAY,GAAGC,WAAW,CAAC;IACnEN,eAAe;IACfO,uBAAuB,EAAGC,KAAK,IAAK;AAClC,MAAA,IAAIA,KAAK,KAAK,WAAW,EAAEP,QAAQ,IAAI,CAAA;AACvC,MAAA,IAAIO,KAAK,KAAK,aAAa,EAAEN,UAAU,IAAI,CAAA;AAC7C,KAAA;AACF,GAAC,CAAC,CAAA;EAEF,OAAO;IACLO,WAAW,EAAEN,cAAc,EAAE;IAC7BO,aAAa,EAAEN,gBAAgB,EAAE;AACjCC,IAAAA,UAAAA;GACD,CAAA;AACH;;;;"}
@@ -1,10 +1,27 @@
1
+ /// <reference types="react" />
1
2
  import { AccordionProps } from './types.js';
2
- import { GetCollapsePropsOutput, GetTogglePropsOutput } from 'react-collapsed/dist/types.js';
3
- declare type UseExpanded = (props: Pick<AccordionProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>) => {
4
- toggleProps: GetTogglePropsOutput;
5
- collapseProps: GetCollapsePropsOutput;
3
+ export declare const useExpanded: ({ defaultExpanded, onExpand, onCollapse, }: Pick<AccordionProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>) => {
4
+ toggleProps: {
5
+ ref: ((instance: any) => void) | import("react").MutableRefObject<any>;
6
+ } & {
7
+ onClick: import("react").MouseEventHandler<Element>;
8
+ id: string;
9
+ 'aria-controls': string;
10
+ 'aria-expanded'?: boolean | undefined;
11
+ type?: "button" | undefined;
12
+ disabled?: boolean | undefined;
13
+ 'aria-disabled'?: boolean | undefined;
14
+ role?: "button" | undefined;
15
+ tabIndex?: number | undefined;
16
+ };
17
+ collapseProps: {
18
+ ref: ((instance: any) => void) | import("react").MutableRefObject<any>;
19
+ } & {
20
+ id: string;
21
+ 'aria-hidden': boolean;
22
+ role: string;
23
+ style: import("react").CSSProperties;
24
+ };
6
25
  isExpanded: boolean;
7
26
  };
8
- export declare const useExpanded: UseExpanded;
9
- export {};
10
27
  //# sourceMappingURL=useExpanded.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useExpanded.d.ts","sourceRoot":"","sources":["../../../packages/accordion/useExpanded.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,+BAA+B,CAAA;AAKtC,aAAK,WAAW,GAAG,CACjB,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,iBAAiB,GAAG,UAAU,GAAG,YAAY,CAAC,KACvE;IACH,WAAW,EAAE,oBAAoB,CAAA;IACjC,aAAa,EAAE,sBAAsB,CAAA;IACrC,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,WA2BzB,CAAA"}
1
+ {"version":3,"file":"useExpanded.d.ts","sourceRoot":"","sources":["../../../packages/accordion/useExpanded.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,WAAW,+CAIrB,KAAK,cAAc,EAAE,iBAAiB,GAAG,UAAU,GAAG,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAcrE,CAAA"}
@@ -1,10 +1,27 @@
1
+ /// <reference types="react" />
1
2
  import { AccordionTransparentProps } from './types.js';
2
- import { GetCollapsePropsOutput, GetTogglePropsOutput } from 'react-collapsed/dist/types.js';
3
- declare type UseExpanded = (props: Pick<AccordionTransparentProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>) => {
4
- toggleProps: GetTogglePropsOutput;
5
- collapseProps: GetCollapsePropsOutput;
3
+ export declare const useExpanded: ({ defaultExpanded, onExpand, onCollapse, }: Pick<AccordionTransparentProps, 'defaultExpanded' | 'onExpand' | 'onCollapse'>) => {
4
+ toggleProps: {
5
+ ref: ((instance: any) => void) | import("react").MutableRefObject<any>;
6
+ } & {
7
+ onClick: import("react").MouseEventHandler<Element>;
8
+ id: string;
9
+ 'aria-controls': string;
10
+ 'aria-expanded'?: boolean | undefined;
11
+ type?: "button" | undefined;
12
+ disabled?: boolean | undefined;
13
+ 'aria-disabled'?: boolean | undefined;
14
+ role?: "button" | undefined;
15
+ tabIndex?: number | undefined;
16
+ };
17
+ collapseProps: {
18
+ ref: ((instance: any) => void) | import("react").MutableRefObject<any>;
19
+ } & {
20
+ id: string;
21
+ 'aria-hidden': boolean;
22
+ role: string;
23
+ style: import("react").CSSProperties;
24
+ };
6
25
  isExpanded: boolean;
7
26
  };
8
- export declare const useExpanded: UseExpanded;
9
- export {};
10
27
  //# sourceMappingURL=useExpanded.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useExpanded.d.ts","sourceRoot":"","sources":["../../../packages/accordion-transparent/useExpanded.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,+BAA+B,CAAA;AAKtC,aAAK,WAAW,GAAG,CACjB,KAAK,EAAE,IAAI,CACT,yBAAyB,EACzB,iBAAiB,GAAG,UAAU,GAAG,YAAY,CAC9C,KACE;IACH,WAAW,EAAE,oBAAoB,CAAA;IACjC,aAAa,EAAE,sBAAsB,CAAA;IACrC,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,WA2BzB,CAAA"}
1
+ {"version":3,"file":"useExpanded.d.ts","sourceRoot":"","sources":["../../../packages/accordion-transparent/useExpanded.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAEtD,eAAO,MAAM,WAAW,+CAIrB,KACD,yBAAyB,EACzB,iBAAiB,GAAG,UAAU,GAAG,YAAY,CAC9C;;;;;;;;;;;;;;;;;;;;;;;CAcA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lidofinance/lido-ui",
3
- "version": "3.42.0",
3
+ "version": "3.42.1",
4
4
  "homepage": "https://github.com/lidofinance/ui",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@styled-system/should-forward-prop": "5.1.5",
53
- "react-collapsed": "3.0.2",
53
+ "react-collapsed": "4.2.0",
54
54
  "react-jazzicon": "^1.0.4",
55
55
  "react-toastify": "7.0.4",
56
56
  "react-transition-group": "4",