@lidofinance/lido-ui 3.41.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.
- package/dist/cjs/accordion/useExpanded.js +10 -17
- package/dist/cjs/accordion/useExpanded.js.map +1 -1
- package/dist/cjs/accordion-transparent/useExpanded.js +10 -17
- package/dist/cjs/accordion-transparent/useExpanded.js.map +1 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/switcher/Switcher.js +100 -0
- package/dist/cjs/switcher/Switcher.js.map +1 -0
- package/dist/cjs/switcher/SwitcherItem.js +32 -0
- package/dist/cjs/switcher/SwitcherItem.js.map +1 -0
- package/dist/cjs/switcher/SwitcherStyles.js +108 -0
- package/dist/cjs/switcher/SwitcherStyles.js.map +1 -0
- package/dist/esm/accordion/useExpanded.mjs +9 -16
- package/dist/esm/accordion/useExpanded.mjs.map +1 -1
- package/dist/esm/accordion-transparent/useExpanded.mjs +9 -16
- package/dist/esm/accordion-transparent/useExpanded.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/switcher/Switcher.mjs +96 -0
- package/dist/esm/switcher/Switcher.mjs.map +1 -0
- package/dist/esm/switcher/SwitcherItem.mjs +28 -0
- package/dist/esm/switcher/SwitcherItem.mjs.map +1 -0
- package/dist/esm/switcher/SwitcherStyles.mjs +101 -0
- package/dist/esm/switcher/SwitcherStyles.mjs.map +1 -0
- package/dist/types/accordion/useExpanded.d.ts +23 -6
- package/dist/types/accordion/useExpanded.d.ts.map +1 -1
- package/dist/types/accordion-transparent/useExpanded.d.ts +23 -6
- package/dist/types/accordion-transparent/useExpanded.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/switcher/Switcher.d.ts +11 -0
- package/dist/types/switcher/Switcher.d.ts.map +1 -0
- package/dist/types/switcher/SwitcherItem.d.ts +12 -0
- package/dist/types/switcher/SwitcherItem.d.ts.map +1 -0
- package/dist/types/switcher/SwitcherStyles.d.ts +9 -0
- package/dist/types/switcher/SwitcherStyles.d.ts.map +1 -0
- package/dist/types/switcher/index.d.ts +4 -0
- package/dist/types/switcher/index.d.ts.map +1 -0
- package/dist/types/switcher/types.d.ts +11 -0
- package/dist/types/switcher/types.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -2,34 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 {
|
|
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
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 {
|
|
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;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -74,6 +74,8 @@ const HStack = require('./stack/HStack.js');
|
|
|
74
74
|
const VStack = require('./stack/VStack.js');
|
|
75
75
|
const types$e = require('./stack/types.js');
|
|
76
76
|
const withStyledSystem = require('./styled-system/withStyledSystem.js');
|
|
77
|
+
const Switcher = require('./switcher/Switcher.js');
|
|
78
|
+
const SwitcherItem = require('./switcher/SwitcherItem.js');
|
|
77
79
|
const Table = require('./table/Table.js');
|
|
78
80
|
const Thead = require('./table/Thead.js');
|
|
79
81
|
const Tbody = require('./table/Tbody.js');
|
|
@@ -300,6 +302,8 @@ exports.StackJustify = types$e.StackJustify;
|
|
|
300
302
|
exports.StackSpacing = types$e.StackSpacing;
|
|
301
303
|
exports.StackWrap = types$e.StackWrap;
|
|
302
304
|
exports.withStyledSystem = withStyledSystem;
|
|
305
|
+
exports.Switcher = Switcher.Switcher;
|
|
306
|
+
exports.SwitcherItem = SwitcherItem.SwitcherItem;
|
|
303
307
|
exports.Table = Table.Table;
|
|
304
308
|
exports.Thead = Thead.Thead;
|
|
305
309
|
exports.Tbody = Tbody.Tbody;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const React = require('react');
|
|
6
|
+
require('../utils/styled-components-wrapper.js');
|
|
7
|
+
require('use-callback-ref');
|
|
8
|
+
const useIsomorphicLayoutEffect = require('../hooks/useIsomorphicLayoutEffect.js');
|
|
9
|
+
require('../theme/cookie-theme-provider.js');
|
|
10
|
+
require('../theme/theme-provider.js');
|
|
11
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
12
|
+
require('../theme/document-head-contents/element-theme-colors.js');
|
|
13
|
+
require('../utils/modalRoot.js');
|
|
14
|
+
require('../utils/cookies-client-side.js');
|
|
15
|
+
require('../theme/constants.js');
|
|
16
|
+
require('../theme/utils/set-theme-cookie.js');
|
|
17
|
+
require('../theme/themes.js');
|
|
18
|
+
const SwitcherStyles = require('./SwitcherStyles.js');
|
|
19
|
+
|
|
20
|
+
const Switcher = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
children,
|
|
23
|
+
...rest
|
|
24
|
+
} = _ref;
|
|
25
|
+
const listRef = React.useRef(null);
|
|
26
|
+
const setRefs = React.useCallback(node => {
|
|
27
|
+
listRef.current = node;
|
|
28
|
+
if (typeof ref === 'function') {
|
|
29
|
+
ref(node);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (ref) {
|
|
33
|
+
ref.current = node;
|
|
34
|
+
}
|
|
35
|
+
}, [ref]);
|
|
36
|
+
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
37
|
+
if (typeof window === 'undefined') return undefined;
|
|
38
|
+
const listNode = listRef.current;
|
|
39
|
+
if (!listNode) return undefined;
|
|
40
|
+
let rafId = 0;
|
|
41
|
+
const updateIndicator = () => {
|
|
42
|
+
const activeItem = listNode.querySelector('[role="tab"][aria-selected="true"]');
|
|
43
|
+
if (!activeItem) {
|
|
44
|
+
listNode.style.setProperty('--switcher-indicator-left', '0px');
|
|
45
|
+
listNode.style.setProperty('--switcher-indicator-width', '0px');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const listRect = listNode.getBoundingClientRect();
|
|
49
|
+
const itemRect = activeItem.getBoundingClientRect();
|
|
50
|
+
const left = itemRect.left - listRect.left + listNode.scrollLeft;
|
|
51
|
+
listNode.style.setProperty('--switcher-indicator-left', `${left}px`);
|
|
52
|
+
listNode.style.setProperty('--switcher-indicator-width', `${itemRect.width}px`);
|
|
53
|
+
};
|
|
54
|
+
const scheduleUpdate = () => {
|
|
55
|
+
if (rafId) {
|
|
56
|
+
window.cancelAnimationFrame(rafId);
|
|
57
|
+
}
|
|
58
|
+
rafId = window.requestAnimationFrame(updateIndicator);
|
|
59
|
+
};
|
|
60
|
+
updateIndicator();
|
|
61
|
+
scheduleUpdate();
|
|
62
|
+
listNode.addEventListener('scroll', scheduleUpdate, {
|
|
63
|
+
passive: true
|
|
64
|
+
});
|
|
65
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
66
|
+
const mutationObserver = typeof MutationObserver === 'undefined' ? null : new MutationObserver(scheduleUpdate);
|
|
67
|
+
mutationObserver?.observe(listNode, {
|
|
68
|
+
attributes: true,
|
|
69
|
+
subtree: true,
|
|
70
|
+
attributeFilter: ['aria-selected']
|
|
71
|
+
});
|
|
72
|
+
const resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleUpdate);
|
|
73
|
+
resizeObserver?.observe(listNode);
|
|
74
|
+
listNode.querySelectorAll('[role="tab"]').forEach(tab => resizeObserver?.observe(tab));
|
|
75
|
+
if (typeof document !== 'undefined' && 'fonts' in document) {
|
|
76
|
+
void document.fonts.ready.then(scheduleUpdate);
|
|
77
|
+
}
|
|
78
|
+
return () => {
|
|
79
|
+
if (rafId) {
|
|
80
|
+
window.cancelAnimationFrame(rafId);
|
|
81
|
+
}
|
|
82
|
+
listNode.removeEventListener('scroll', scheduleUpdate);
|
|
83
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
84
|
+
mutationObserver?.disconnect();
|
|
85
|
+
resizeObserver?.disconnect();
|
|
86
|
+
};
|
|
87
|
+
}, [children]);
|
|
88
|
+
return /*#__PURE__*/jsxRuntime.jsxs(SwitcherStyles.SwitcherListStyle, {
|
|
89
|
+
role: "tablist",
|
|
90
|
+
ref: setRefs,
|
|
91
|
+
...rest,
|
|
92
|
+
children: [children, /*#__PURE__*/jsxRuntime.jsx(SwitcherStyles.SwitcherIndicatorStyle, {
|
|
93
|
+
"aria-hidden": true
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
Switcher.displayName = 'Switcher';
|
|
98
|
+
|
|
99
|
+
exports.Switcher = Switcher;
|
|
100
|
+
//# sourceMappingURL=Switcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switcher.js","sources":["../../../packages/switcher/Switcher.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, useCallback, useRef } from 'react'\nimport { useIsomorphicLayoutEffect } from '../hooks'\nimport { SwitcherProps } from './types.js'\nimport { SwitcherIndicatorStyle, SwitcherListStyle } from './SwitcherStyles.js'\n\n/**\n * Segmented control container for SwitcherItem options.\n */\nexport const Switcher = forwardRef(\n (\n { children, ...rest }: SwitcherProps,\n ref?: ForwardedRef<HTMLDivElement>,\n ) => {\n const listRef = useRef<HTMLDivElement | null>(null)\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n listRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n return\n }\n if (ref) {\n ;(ref as { current: HTMLDivElement | null }).current = node\n }\n },\n [ref],\n )\n\n useIsomorphicLayoutEffect(() => {\n if (typeof window === 'undefined') return undefined\n const listNode = listRef.current\n if (!listNode) return undefined\n let rafId = 0\n\n const updateIndicator = () => {\n const activeItem = listNode.querySelector<HTMLElement>(\n '[role=\"tab\"][aria-selected=\"true\"]',\n )\n if (!activeItem) {\n listNode.style.setProperty('--switcher-indicator-left', '0px')\n listNode.style.setProperty('--switcher-indicator-width', '0px')\n return\n }\n\n const listRect = listNode.getBoundingClientRect()\n const itemRect = activeItem.getBoundingClientRect()\n const left = itemRect.left - listRect.left + listNode.scrollLeft\n\n listNode.style.setProperty('--switcher-indicator-left', `${left}px`)\n listNode.style.setProperty(\n '--switcher-indicator-width',\n `${itemRect.width}px`,\n )\n }\n\n const scheduleUpdate = () => {\n if (rafId) {\n window.cancelAnimationFrame(rafId)\n }\n rafId = window.requestAnimationFrame(updateIndicator)\n }\n\n updateIndicator()\n scheduleUpdate()\n listNode.addEventListener('scroll', scheduleUpdate, { passive: true })\n window.addEventListener('resize', scheduleUpdate)\n\n const mutationObserver =\n typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver(scheduleUpdate)\n\n mutationObserver?.observe(listNode, {\n attributes: true,\n subtree: true,\n attributeFilter: ['aria-selected'],\n })\n\n const resizeObserver =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(scheduleUpdate)\n\n resizeObserver?.observe(listNode)\n listNode\n .querySelectorAll<HTMLElement>('[role=\"tab\"]')\n .forEach((tab) => resizeObserver?.observe(tab))\n\n if (typeof document !== 'undefined' && 'fonts' in document) {\n void (document as Document & { fonts: FontFaceSet }).fonts.ready.then(\n scheduleUpdate,\n )\n }\n\n return () => {\n if (rafId) {\n window.cancelAnimationFrame(rafId)\n }\n listNode.removeEventListener('scroll', scheduleUpdate)\n window.removeEventListener('resize', scheduleUpdate)\n mutationObserver?.disconnect()\n resizeObserver?.disconnect()\n }\n }, [children])\n\n return (\n <SwitcherListStyle role='tablist' ref={setRefs} {...rest}>\n {children}\n <SwitcherIndicatorStyle aria-hidden />\n </SwitcherListStyle>\n )\n },\n)\nSwitcher.displayName = 'Switcher'\n"],"names":["Switcher","forwardRef","_ref","ref","children","rest","listRef","useRef","setRefs","useCallback","node","current","useIsomorphicLayoutEffect","window","undefined","listNode","rafId","updateIndicator","activeItem","querySelector","style","setProperty","listRect","getBoundingClientRect","itemRect","left","scrollLeft","width","scheduleUpdate","cancelAnimationFrame","requestAnimationFrame","addEventListener","passive","mutationObserver","MutationObserver","observe","attributes","subtree","attributeFilter","resizeObserver","ResizeObserver","querySelectorAll","forEach","tab","document","fonts","ready","then","removeEventListener","disconnect","_jsxs","SwitcherListStyle","role","_jsx","SwitcherIndicatorStyle","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;AAQO,MAAMA,QAAQ,gBAAGC,gBAAU,CAChC,CAAAC,IAAA,EAEEC,GAAkC,KAC/B;EAAA,IAFH;IAAEC,QAAQ;IAAE,GAAGC,IAAAA;AAAoB,GAAC,GAAAH,IAAA,CAAA;AAGpC,EAAA,MAAMI,OAAO,GAAGC,YAAM,CAAwB,IAAI,CAAC,CAAA;AACnD,EAAA,MAAMC,OAAO,GAAGC,iBAAW,CACxBC,IAA2B,IAAK;IAC/BJ,OAAO,CAACK,OAAO,GAAGD,IAAI,CAAA;AACtB,IAAA,IAAI,OAAOP,GAAG,KAAK,UAAU,EAAE;MAC7BA,GAAG,CAACO,IAAI,CAAC,CAAA;AACT,MAAA,OAAA;AACF,KAAA;AACA,IAAA,IAAIP,GAAG,EAAE;MACLA,GAAG,CAAwCQ,OAAO,GAAGD,IAAI,CAAA;AAC7D,KAAA;AACF,GAAC,EACD,CAACP,GAAG,CACN,CAAC,CAAA;AAEDS,EAAAA,mDAAyB,CAAC,MAAM;AAC9B,IAAA,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAOC,SAAS,CAAA;AACnD,IAAA,MAAMC,QAAQ,GAAGT,OAAO,CAACK,OAAO,CAAA;AAChC,IAAA,IAAI,CAACI,QAAQ,EAAE,OAAOD,SAAS,CAAA;IAC/B,IAAIE,KAAK,GAAG,CAAC,CAAA;IAEb,MAAMC,eAAe,GAAGA,MAA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AAQ,CAAC,CAAC,CAAA;EAEd,oBACE8C,eAAA,CAACC,gCAAiB,EAAA;AAACC,IAAAA,IAAI,EAAC,SAAS;AAACjD,IAAAA,GAAG,EAAEK,OAAQ;AAAA,IAAA,GAAKH,IAAI;AAAAD,IAAAA,QAAA,EACrDA,CAAAA,QAAQ,eACTiD,cAAA,CAACC,qCAAsB,EAAA;AAAC,MAAA,aAAA,EAAA,IAAA;AAAW,KAAE,CAAC,CAAA;AAAA,GACrB,CAAC,CAAA;AAExB,CACF,EAAC;AACDtD,QAAQ,CAACuD,WAAW,GAAG,UAAU;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const React = require('react');
|
|
6
|
+
const SwitcherStyles = require('./SwitcherStyles.js');
|
|
7
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
const SwitcherItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
10
|
+
let {
|
|
11
|
+
active = false,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/jsxRuntime.jsx(SwitcherStyles.SwitcherItemStyle, {
|
|
16
|
+
$active: active,
|
|
17
|
+
"aria-selected": active,
|
|
18
|
+
role: "tab",
|
|
19
|
+
tabIndex: active ? 0 : -1,
|
|
20
|
+
type: "button",
|
|
21
|
+
ref: ref,
|
|
22
|
+
...rest,
|
|
23
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SwitcherStyles.SwitcherLabelStyle, {
|
|
24
|
+
$active: active,
|
|
25
|
+
children: children
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
SwitcherItem.displayName = 'SwitcherItem';
|
|
30
|
+
|
|
31
|
+
exports.SwitcherItem = SwitcherItem;
|
|
32
|
+
//# sourceMappingURL=SwitcherItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitcherItem.js","sources":["../../../packages/switcher/SwitcherItem.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport { SwitcherItemProps } from './types.js'\nimport { SwitcherItemStyle, SwitcherLabelStyle } from './SwitcherStyles.js'\n\n/**\n * Switcher option button.\n */\nexport const SwitcherItem = forwardRef(\n (\n { active = false, children, ...rest }: SwitcherItemProps,\n ref?: ForwardedRef<HTMLButtonElement>,\n ) => {\n return (\n <SwitcherItemStyle\n $active={active}\n aria-selected={active}\n role='tab'\n tabIndex={active ? 0 : -1}\n type='button'\n ref={ref}\n {...rest}\n >\n <SwitcherLabelStyle $active={active}>{children}</SwitcherLabelStyle>\n </SwitcherItemStyle>\n )\n },\n)\nSwitcherItem.displayName = 'SwitcherItem'\n"],"names":["SwitcherItem","forwardRef","_ref","ref","active","children","rest","_jsx","SwitcherItemStyle","$active","role","tabIndex","type","SwitcherLabelStyle","displayName"],"mappings":";;;;;;;;AAOO,MAAMA,YAAY,gBAAGC,gBAAU,CACpC,CAAAC,IAAA,EAEEC,GAAqC,KAClC;EAAA,IAFH;AAAEC,IAAAA,MAAM,GAAG,KAAK;IAAEC,QAAQ;IAAE,GAAGC,IAAAA;AAAwB,GAAC,GAAAJ,IAAA,CAAA;EAGxD,oBACEK,cAAA,CAACC,gCAAiB,EAAA;AAChBC,IAAAA,OAAO,EAAEL,MAAO;AAChB,IAAA,eAAA,EAAeA,MAAO;AACtBM,IAAAA,IAAI,EAAC,KAAK;AACVC,IAAAA,QAAQ,EAAEP,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE;AAC1BQ,IAAAA,IAAI,EAAC,QAAQ;AACbT,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLG,IAAI;IAAAD,QAAA,eAERE,cAAA,CAACM,iCAAkB,EAAA;AAACJ,MAAAA,OAAO,EAAEL,MAAO;AAAAC,MAAAA,QAAA,EAAEA,QAAAA;KAA6B,CAAA;AAAC,GACnD,CAAC,CAAA;AAExB,CACF,EAAC;AACDL,YAAY,CAACc,WAAW,GAAG,cAAc;;;;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const styledComponentsWrapper = require('../utils/styled-components-wrapper.js');
|
|
6
|
+
|
|
7
|
+
const CONTAINER_PADDING = 2;
|
|
8
|
+
const ITEM_PADDING_Y = 2;
|
|
9
|
+
const ITEM_PADDING_X = 12;
|
|
10
|
+
const PILL_RADIUS = 110;
|
|
11
|
+
const SwitcherListStyle = styledComponentsWrapper.default.div`
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 0;
|
|
15
|
+
padding: ${CONTAINER_PADDING}px;
|
|
16
|
+
background: var(--lido-color-backgroundDarken);
|
|
17
|
+
border-radius: ${PILL_RADIUS}px;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
position: relative;
|
|
20
|
+
|
|
21
|
+
--switcher-indicator-left: 0px;
|
|
22
|
+
--switcher-indicator-width: 0px;
|
|
23
|
+
`;
|
|
24
|
+
const SwitcherIndicatorStyle = styledComponentsWrapper.default.span`
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: ${CONTAINER_PADDING}px;
|
|
27
|
+
bottom: ${CONTAINER_PADDING}px;
|
|
28
|
+
left: 0;
|
|
29
|
+
width: var(--switcher-indicator-width, 0);
|
|
30
|
+
background: var(--lido-color-foreground);
|
|
31
|
+
border-radius: ${PILL_RADIUS}px;
|
|
32
|
+
transition:
|
|
33
|
+
transform ${_ref => {
|
|
34
|
+
let {
|
|
35
|
+
theme
|
|
36
|
+
} = _ref;
|
|
37
|
+
return theme.duration.norm;
|
|
38
|
+
}} ease,
|
|
39
|
+
width ${_ref2 => {
|
|
40
|
+
let {
|
|
41
|
+
theme
|
|
42
|
+
} = _ref2;
|
|
43
|
+
return theme.duration.norm;
|
|
44
|
+
}} ease;
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
z-index: 0;
|
|
47
|
+
will-change: transform, width;
|
|
48
|
+
transform: translateX(var(--switcher-indicator-left, 0));
|
|
49
|
+
`;
|
|
50
|
+
const SwitcherLabelStyle = styledComponentsWrapper.default.span`
|
|
51
|
+
font-size: ${_ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
theme
|
|
54
|
+
} = _ref3;
|
|
55
|
+
return theme.fontSizesMap.xxs;
|
|
56
|
+
}}px;
|
|
57
|
+
line-height: 20px;
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
color: var(--lido-color-text);
|
|
60
|
+
opacity: ${_ref4 => {
|
|
61
|
+
let {
|
|
62
|
+
$active
|
|
63
|
+
} = _ref4;
|
|
64
|
+
return $active ? 1 : 0.5;
|
|
65
|
+
}};
|
|
66
|
+
transition: opacity ${_ref5 => {
|
|
67
|
+
let {
|
|
68
|
+
theme
|
|
69
|
+
} = _ref5;
|
|
70
|
+
return theme.duration.fast;
|
|
71
|
+
}} ease;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
`;
|
|
74
|
+
const SwitcherItemStyle = styledComponentsWrapper.default.button`
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
margin: 0;
|
|
79
|
+
border: none;
|
|
80
|
+
background: transparent;
|
|
81
|
+
padding: ${ITEM_PADDING_Y}px ${ITEM_PADDING_X}px;
|
|
82
|
+
border-radius: ${PILL_RADIUS}px;
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
color: var(--lido-color-text);
|
|
86
|
+
font-family: inherit;
|
|
87
|
+
-webkit-tap-highlight-color: transparent;
|
|
88
|
+
position: relative;
|
|
89
|
+
z-index: 1;
|
|
90
|
+
|
|
91
|
+
&:hover ${SwitcherLabelStyle}, &:focus-visible ${SwitcherLabelStyle} {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:disabled {
|
|
96
|
+
cursor: default;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:disabled ${SwitcherLabelStyle} {
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
exports.SwitcherIndicatorStyle = SwitcherIndicatorStyle;
|
|
105
|
+
exports.SwitcherItemStyle = SwitcherItemStyle;
|
|
106
|
+
exports.SwitcherLabelStyle = SwitcherLabelStyle;
|
|
107
|
+
exports.SwitcherListStyle = SwitcherListStyle;
|
|
108
|
+
//# sourceMappingURL=SwitcherStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitcherStyles.js","sources":["../../../packages/switcher/SwitcherStyles.tsx"],"sourcesContent":["import styled from '../utils/styled-components-wrapper.js'\n\ntype InjectedProps = {\n $active: boolean\n}\n\nconst CONTAINER_PADDING = 2\nconst ITEM_PADDING_Y = 2\nconst ITEM_PADDING_X = 12\nconst PILL_RADIUS = 110\n\nexport const SwitcherListStyle = styled.div`\n display: inline-flex;\n align-items: center;\n gap: 0;\n padding: ${CONTAINER_PADDING}px;\n background: var(--lido-color-backgroundDarken);\n border-radius: ${PILL_RADIUS}px;\n box-sizing: border-box;\n position: relative;\n\n --switcher-indicator-left: 0px;\n --switcher-indicator-width: 0px;\n`\n\nexport const SwitcherIndicatorStyle = styled.span`\n position: absolute;\n top: ${CONTAINER_PADDING}px;\n bottom: ${CONTAINER_PADDING}px;\n left: 0;\n width: var(--switcher-indicator-width, 0);\n background: var(--lido-color-foreground);\n border-radius: ${PILL_RADIUS}px;\n transition:\n transform ${({ theme }) => theme.duration.norm} ease,\n width ${({ theme }) => theme.duration.norm} ease;\n pointer-events: none;\n z-index: 0;\n will-change: transform, width;\n transform: translateX(var(--switcher-indicator-left, 0));\n`\n\nexport const SwitcherLabelStyle = styled.span<InjectedProps>`\n font-size: ${({ theme }) => theme.fontSizesMap.xxs}px;\n line-height: 20px;\n font-weight: 700;\n color: var(--lido-color-text);\n opacity: ${({ $active }) => ($active ? 1 : 0.5)};\n transition: opacity ${({ theme }) => theme.duration.fast} ease;\n white-space: nowrap;\n`\n\nexport const SwitcherItemStyle = styled.button<InjectedProps>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n border: none;\n background: transparent;\n padding: ${ITEM_PADDING_Y}px ${ITEM_PADDING_X}px;\n border-radius: ${PILL_RADIUS}px;\n box-sizing: border-box;\n cursor: pointer;\n color: var(--lido-color-text);\n font-family: inherit;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 1;\n\n &:hover ${SwitcherLabelStyle}, &:focus-visible ${SwitcherLabelStyle} {\n opacity: 1;\n }\n\n &:disabled {\n cursor: default;\n }\n\n &:disabled ${SwitcherLabelStyle} {\n opacity: 0.5;\n }\n`\n"],"names":["CONTAINER_PADDING","ITEM_PADDING_Y","ITEM_PADDING_X","PILL_RADIUS","SwitcherListStyle","styled","div","SwitcherIndicatorStyle","span","_ref","theme","duration","norm","_ref2","SwitcherLabelStyle","_ref3","fontSizesMap","xxs","_ref4","$active","_ref5","fast","SwitcherItemStyle","button"],"mappings":";;;;;;AAMA,MAAMA,iBAAiB,GAAG,CAAC,CAAA;AAC3B,MAAMC,cAAc,GAAG,CAAC,CAAA;AACxB,MAAMC,cAAc,GAAG,EAAE,CAAA;AACzB,MAAMC,WAAW,GAAG,GAAG,CAAA;AAEVC,MAAAA,iBAAiB,GAAGC,+BAAM,CAACC,GAAG,CAAA;AAC3C;AACA;AACA;AACA,WAAA,EAAaN,iBAAiB,CAAA;AAC9B;AACA,iBAAA,EAAmBG,WAAW,CAAA;AAC9B;AACA;AACA;AACA;AACA;AACA,EAAC;AAEYI,MAAAA,sBAAsB,GAAGF,+BAAM,CAACG,IAAI,CAAA;AACjD;AACA,OAAA,EAASR,iBAAiB,CAAA;AA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AAA;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAYW,EAAAA,kBAAkB,qBAAqBA,kBAAkB,CAAA;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAA,EAAeA,kBAAkB,CAAA;AACjC;AACA;AACA;;;;;;;"}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 {
|
|
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;;;;"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -70,6 +70,8 @@ export { HStack } from './stack/HStack.mjs';
|
|
|
70
70
|
export { VStack } from './stack/VStack.mjs';
|
|
71
71
|
export { StackAlign, StackDirection, StackJustify, StackSpacing, StackWrap } from './stack/types.mjs';
|
|
72
72
|
export { default as withStyledSystem } from './styled-system/withStyledSystem.mjs';
|
|
73
|
+
export { Switcher } from './switcher/Switcher.mjs';
|
|
74
|
+
export { SwitcherItem } from './switcher/SwitcherItem.mjs';
|
|
73
75
|
export { Table } from './table/Table.mjs';
|
|
74
76
|
export { Thead } from './table/Thead.mjs';
|
|
75
77
|
export { Tbody } from './table/Tbody.mjs';
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { forwardRef, useRef, useCallback } from 'react';
|
|
2
|
+
import '../utils/styled-components-wrapper.mjs';
|
|
3
|
+
import 'use-callback-ref';
|
|
4
|
+
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect.mjs';
|
|
5
|
+
import '../theme/cookie-theme-provider.mjs';
|
|
6
|
+
import '../theme/theme-provider.mjs';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
import '../theme/document-head-contents/element-theme-colors.mjs';
|
|
9
|
+
import '../utils/modalRoot.mjs';
|
|
10
|
+
import '../utils/cookies-client-side.mjs';
|
|
11
|
+
import '../theme/constants.mjs';
|
|
12
|
+
import '../theme/utils/set-theme-cookie.mjs';
|
|
13
|
+
import '../theme/themes.mjs';
|
|
14
|
+
import { SwitcherListStyle, SwitcherIndicatorStyle } from './SwitcherStyles.mjs';
|
|
15
|
+
|
|
16
|
+
const Switcher = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
} = _ref;
|
|
21
|
+
const listRef = useRef(null);
|
|
22
|
+
const setRefs = useCallback(node => {
|
|
23
|
+
listRef.current = node;
|
|
24
|
+
if (typeof ref === 'function') {
|
|
25
|
+
ref(node);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (ref) {
|
|
29
|
+
ref.current = node;
|
|
30
|
+
}
|
|
31
|
+
}, [ref]);
|
|
32
|
+
useIsomorphicLayoutEffect(() => {
|
|
33
|
+
if (typeof window === 'undefined') return undefined;
|
|
34
|
+
const listNode = listRef.current;
|
|
35
|
+
if (!listNode) return undefined;
|
|
36
|
+
let rafId = 0;
|
|
37
|
+
const updateIndicator = () => {
|
|
38
|
+
const activeItem = listNode.querySelector('[role="tab"][aria-selected="true"]');
|
|
39
|
+
if (!activeItem) {
|
|
40
|
+
listNode.style.setProperty('--switcher-indicator-left', '0px');
|
|
41
|
+
listNode.style.setProperty('--switcher-indicator-width', '0px');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const listRect = listNode.getBoundingClientRect();
|
|
45
|
+
const itemRect = activeItem.getBoundingClientRect();
|
|
46
|
+
const left = itemRect.left - listRect.left + listNode.scrollLeft;
|
|
47
|
+
listNode.style.setProperty('--switcher-indicator-left', `${left}px`);
|
|
48
|
+
listNode.style.setProperty('--switcher-indicator-width', `${itemRect.width}px`);
|
|
49
|
+
};
|
|
50
|
+
const scheduleUpdate = () => {
|
|
51
|
+
if (rafId) {
|
|
52
|
+
window.cancelAnimationFrame(rafId);
|
|
53
|
+
}
|
|
54
|
+
rafId = window.requestAnimationFrame(updateIndicator);
|
|
55
|
+
};
|
|
56
|
+
updateIndicator();
|
|
57
|
+
scheduleUpdate();
|
|
58
|
+
listNode.addEventListener('scroll', scheduleUpdate, {
|
|
59
|
+
passive: true
|
|
60
|
+
});
|
|
61
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
62
|
+
const mutationObserver = typeof MutationObserver === 'undefined' ? null : new MutationObserver(scheduleUpdate);
|
|
63
|
+
mutationObserver?.observe(listNode, {
|
|
64
|
+
attributes: true,
|
|
65
|
+
subtree: true,
|
|
66
|
+
attributeFilter: ['aria-selected']
|
|
67
|
+
});
|
|
68
|
+
const resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleUpdate);
|
|
69
|
+
resizeObserver?.observe(listNode);
|
|
70
|
+
listNode.querySelectorAll('[role="tab"]').forEach(tab => resizeObserver?.observe(tab));
|
|
71
|
+
if (typeof document !== 'undefined' && 'fonts' in document) {
|
|
72
|
+
void document.fonts.ready.then(scheduleUpdate);
|
|
73
|
+
}
|
|
74
|
+
return () => {
|
|
75
|
+
if (rafId) {
|
|
76
|
+
window.cancelAnimationFrame(rafId);
|
|
77
|
+
}
|
|
78
|
+
listNode.removeEventListener('scroll', scheduleUpdate);
|
|
79
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
80
|
+
mutationObserver?.disconnect();
|
|
81
|
+
resizeObserver?.disconnect();
|
|
82
|
+
};
|
|
83
|
+
}, [children]);
|
|
84
|
+
return /*#__PURE__*/jsxs(SwitcherListStyle, {
|
|
85
|
+
role: "tablist",
|
|
86
|
+
ref: setRefs,
|
|
87
|
+
...rest,
|
|
88
|
+
children: [children, /*#__PURE__*/jsx(SwitcherIndicatorStyle, {
|
|
89
|
+
"aria-hidden": true
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
Switcher.displayName = 'Switcher';
|
|
94
|
+
|
|
95
|
+
export { Switcher };
|
|
96
|
+
//# sourceMappingURL=Switcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switcher.mjs","sources":["../../../packages/switcher/Switcher.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, useCallback, useRef } from 'react'\nimport { useIsomorphicLayoutEffect } from '../hooks'\nimport { SwitcherProps } from './types.js'\nimport { SwitcherIndicatorStyle, SwitcherListStyle } from './SwitcherStyles.js'\n\n/**\n * Segmented control container for SwitcherItem options.\n */\nexport const Switcher = forwardRef(\n (\n { children, ...rest }: SwitcherProps,\n ref?: ForwardedRef<HTMLDivElement>,\n ) => {\n const listRef = useRef<HTMLDivElement | null>(null)\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n listRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n return\n }\n if (ref) {\n ;(ref as { current: HTMLDivElement | null }).current = node\n }\n },\n [ref],\n )\n\n useIsomorphicLayoutEffect(() => {\n if (typeof window === 'undefined') return undefined\n const listNode = listRef.current\n if (!listNode) return undefined\n let rafId = 0\n\n const updateIndicator = () => {\n const activeItem = listNode.querySelector<HTMLElement>(\n '[role=\"tab\"][aria-selected=\"true\"]',\n )\n if (!activeItem) {\n listNode.style.setProperty('--switcher-indicator-left', '0px')\n listNode.style.setProperty('--switcher-indicator-width', '0px')\n return\n }\n\n const listRect = listNode.getBoundingClientRect()\n const itemRect = activeItem.getBoundingClientRect()\n const left = itemRect.left - listRect.left + listNode.scrollLeft\n\n listNode.style.setProperty('--switcher-indicator-left', `${left}px`)\n listNode.style.setProperty(\n '--switcher-indicator-width',\n `${itemRect.width}px`,\n )\n }\n\n const scheduleUpdate = () => {\n if (rafId) {\n window.cancelAnimationFrame(rafId)\n }\n rafId = window.requestAnimationFrame(updateIndicator)\n }\n\n updateIndicator()\n scheduleUpdate()\n listNode.addEventListener('scroll', scheduleUpdate, { passive: true })\n window.addEventListener('resize', scheduleUpdate)\n\n const mutationObserver =\n typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver(scheduleUpdate)\n\n mutationObserver?.observe(listNode, {\n attributes: true,\n subtree: true,\n attributeFilter: ['aria-selected'],\n })\n\n const resizeObserver =\n typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(scheduleUpdate)\n\n resizeObserver?.observe(listNode)\n listNode\n .querySelectorAll<HTMLElement>('[role=\"tab\"]')\n .forEach((tab) => resizeObserver?.observe(tab))\n\n if (typeof document !== 'undefined' && 'fonts' in document) {\n void (document as Document & { fonts: FontFaceSet }).fonts.ready.then(\n scheduleUpdate,\n )\n }\n\n return () => {\n if (rafId) {\n window.cancelAnimationFrame(rafId)\n }\n listNode.removeEventListener('scroll', scheduleUpdate)\n window.removeEventListener('resize', scheduleUpdate)\n mutationObserver?.disconnect()\n resizeObserver?.disconnect()\n }\n }, [children])\n\n return (\n <SwitcherListStyle role='tablist' ref={setRefs} {...rest}>\n {children}\n <SwitcherIndicatorStyle aria-hidden />\n </SwitcherListStyle>\n )\n },\n)\nSwitcher.displayName = 'Switcher'\n"],"names":["Switcher","forwardRef","_ref","ref","children","rest","listRef","useRef","setRefs","useCallback","node","current","useIsomorphicLayoutEffect","window","undefined","listNode","rafId","updateIndicator","activeItem","querySelector","style","setProperty","listRect","getBoundingClientRect","itemRect","left","scrollLeft","width","scheduleUpdate","cancelAnimationFrame","requestAnimationFrame","addEventListener","passive","mutationObserver","MutationObserver","observe","attributes","subtree","attributeFilter","resizeObserver","ResizeObserver","querySelectorAll","forEach","tab","document","fonts","ready","then","removeEventListener","disconnect","_jsxs","SwitcherListStyle","role","_jsx","SwitcherIndicatorStyle","displayName"],"mappings":";;;;;;;;;;;;;;;AAQO,MAAMA,QAAQ,gBAAGC,UAAU,CAChC,CAAAC,IAAA,EAEEC,GAAkC,KAC/B;EAAA,IAFH;IAAEC,QAAQ;IAAE,GAAGC,IAAAA;AAAoB,GAAC,GAAAH,IAAA,CAAA;AAGpC,EAAA,MAAMI,OAAO,GAAGC,MAAM,CAAwB,IAAI,CAAC,CAAA;AACnD,EAAA,MAAMC,OAAO,GAAGC,WAAW,CACxBC,IAA2B,IAAK;IAC/BJ,OAAO,CAACK,OAAO,GAAGD,IAAI,CAAA;AACtB,IAAA,IAAI,OAAOP,GAAG,KAAK,UAAU,EAAE;MAC7BA,GAAG,CAACO,IAAI,CAAC,CAAA;AACT,MAAA,OAAA;AACF,KAAA;AACA,IAAA,IAAIP,GAAG,EAAE;MACLA,GAAG,CAAwCQ,OAAO,GAAGD,IAAI,CAAA;AAC7D,KAAA;AACF,GAAC,EACD,CAACP,GAAG,CACN,CAAC,CAAA;AAEDS,EAAAA,yBA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D,MAAAA,QAAQ,CAACiC,mBAAmB,CAAC,QAAQ,EAAEpB,cAAc,CAAC,CAAA;AACtDf,MAAAA,MAAM,CAACmC,mBAAmB,CAAC,QAAQ,EAAEpB,cAAc,CAAC,CAAA;MACpDK,gBAAgB,EAAEgB,UAAU,EAAE,CAAA;MAC9BV,cAAc,EAAEU,UAAU,EAAE,CAAA;KAC7B,CAAA;AACH,GAAC,EAAE,CAAC7C,QAAQ,CAAC,CAAC,CAAA;EAEd,oBACE8C,IAAA,CAACC,iBAAiB,EAAA;AAACC,IAAAA,IAAI,EAAC,SAAS;AAACjD,IAAAA,GAAG,EAAEK,OAAQ;AAAA,IAAA,GAAKH,IAAI;AAAAD,IAAAA,QAAA,EACrDA,CAAAA,QAAQ,eACTiD,GAAA,CAACC,sBAAsB,EAAA;AAAC,MAAA,aAAA,EAAA,IAAA;AAAW,KAAE,CAAC,CAAA;AAAA,GACrB,CAAC,CAAA;AAExB,CACF,EAAC;AACDtD,QAAQ,CAACuD,WAAW,GAAG,UAAU;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { SwitcherItemStyle, SwitcherLabelStyle } from './SwitcherStyles.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const SwitcherItem = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
|
+
let {
|
|
7
|
+
active = false,
|
|
8
|
+
children,
|
|
9
|
+
...rest
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/jsx(SwitcherItemStyle, {
|
|
12
|
+
$active: active,
|
|
13
|
+
"aria-selected": active,
|
|
14
|
+
role: "tab",
|
|
15
|
+
tabIndex: active ? 0 : -1,
|
|
16
|
+
type: "button",
|
|
17
|
+
ref: ref,
|
|
18
|
+
...rest,
|
|
19
|
+
children: /*#__PURE__*/jsx(SwitcherLabelStyle, {
|
|
20
|
+
$active: active,
|
|
21
|
+
children: children
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
SwitcherItem.displayName = 'SwitcherItem';
|
|
26
|
+
|
|
27
|
+
export { SwitcherItem };
|
|
28
|
+
//# sourceMappingURL=SwitcherItem.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitcherItem.mjs","sources":["../../../packages/switcher/SwitcherItem.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport { SwitcherItemProps } from './types.js'\nimport { SwitcherItemStyle, SwitcherLabelStyle } from './SwitcherStyles.js'\n\n/**\n * Switcher option button.\n */\nexport const SwitcherItem = forwardRef(\n (\n { active = false, children, ...rest }: SwitcherItemProps,\n ref?: ForwardedRef<HTMLButtonElement>,\n ) => {\n return (\n <SwitcherItemStyle\n $active={active}\n aria-selected={active}\n role='tab'\n tabIndex={active ? 0 : -1}\n type='button'\n ref={ref}\n {...rest}\n >\n <SwitcherLabelStyle $active={active}>{children}</SwitcherLabelStyle>\n </SwitcherItemStyle>\n )\n },\n)\nSwitcherItem.displayName = 'SwitcherItem'\n"],"names":["SwitcherItem","forwardRef","_ref","ref","active","children","rest","_jsx","SwitcherItemStyle","$active","role","tabIndex","type","SwitcherLabelStyle","displayName"],"mappings":";;;;AAOO,MAAMA,YAAY,gBAAGC,UAAU,CACpC,CAAAC,IAAA,EAEEC,GAAqC,KAClC;EAAA,IAFH;AAAEC,IAAAA,MAAM,GAAG,KAAK;IAAEC,QAAQ;IAAE,GAAGC,IAAAA;AAAwB,GAAC,GAAAJ,IAAA,CAAA;EAGxD,oBACEK,GAAA,CAACC,iBAAiB,EAAA;AAChBC,IAAAA,OAAO,EAAEL,MAAO;AAChB,IAAA,eAAA,EAAeA,MAAO;AACtBM,IAAAA,IAAI,EAAC,KAAK;AACVC,IAAAA,QAAQ,EAAEP,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE;AAC1BQ,IAAAA,IAAI,EAAC,QAAQ;AACbT,IAAAA,GAAG,EAAEA,GAAI;AAAA,IAAA,GACLG,IAAI;IAAAD,QAAA,eAERE,GAAA,CAACM,kBAAkB,EAAA;AAACJ,MAAAA,OAAO,EAAEL,MAAO;AAAAC,MAAAA,QAAA,EAAEA,QAAAA;KAA6B,CAAA;AAAC,GACnD,CAAC,CAAA;AAExB,CACF,EAAC;AACDL,YAAY,CAACc,WAAW,GAAG,cAAc;;;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import styled from '../utils/styled-components-wrapper.mjs';
|
|
2
|
+
|
|
3
|
+
const CONTAINER_PADDING = 2;
|
|
4
|
+
const ITEM_PADDING_Y = 2;
|
|
5
|
+
const ITEM_PADDING_X = 12;
|
|
6
|
+
const PILL_RADIUS = 110;
|
|
7
|
+
const SwitcherListStyle = styled.div`
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 0;
|
|
11
|
+
padding: ${CONTAINER_PADDING}px;
|
|
12
|
+
background: var(--lido-color-backgroundDarken);
|
|
13
|
+
border-radius: ${PILL_RADIUS}px;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
17
|
+
--switcher-indicator-left: 0px;
|
|
18
|
+
--switcher-indicator-width: 0px;
|
|
19
|
+
`;
|
|
20
|
+
const SwitcherIndicatorStyle = styled.span`
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: ${CONTAINER_PADDING}px;
|
|
23
|
+
bottom: ${CONTAINER_PADDING}px;
|
|
24
|
+
left: 0;
|
|
25
|
+
width: var(--switcher-indicator-width, 0);
|
|
26
|
+
background: var(--lido-color-foreground);
|
|
27
|
+
border-radius: ${PILL_RADIUS}px;
|
|
28
|
+
transition:
|
|
29
|
+
transform ${_ref => {
|
|
30
|
+
let {
|
|
31
|
+
theme
|
|
32
|
+
} = _ref;
|
|
33
|
+
return theme.duration.norm;
|
|
34
|
+
}} ease,
|
|
35
|
+
width ${_ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
theme
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return theme.duration.norm;
|
|
40
|
+
}} ease;
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
z-index: 0;
|
|
43
|
+
will-change: transform, width;
|
|
44
|
+
transform: translateX(var(--switcher-indicator-left, 0));
|
|
45
|
+
`;
|
|
46
|
+
const SwitcherLabelStyle = styled.span`
|
|
47
|
+
font-size: ${_ref3 => {
|
|
48
|
+
let {
|
|
49
|
+
theme
|
|
50
|
+
} = _ref3;
|
|
51
|
+
return theme.fontSizesMap.xxs;
|
|
52
|
+
}}px;
|
|
53
|
+
line-height: 20px;
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
color: var(--lido-color-text);
|
|
56
|
+
opacity: ${_ref4 => {
|
|
57
|
+
let {
|
|
58
|
+
$active
|
|
59
|
+
} = _ref4;
|
|
60
|
+
return $active ? 1 : 0.5;
|
|
61
|
+
}};
|
|
62
|
+
transition: opacity ${_ref5 => {
|
|
63
|
+
let {
|
|
64
|
+
theme
|
|
65
|
+
} = _ref5;
|
|
66
|
+
return theme.duration.fast;
|
|
67
|
+
}} ease;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
`;
|
|
70
|
+
const SwitcherItemStyle = styled.button`
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
margin: 0;
|
|
75
|
+
border: none;
|
|
76
|
+
background: transparent;
|
|
77
|
+
padding: ${ITEM_PADDING_Y}px ${ITEM_PADDING_X}px;
|
|
78
|
+
border-radius: ${PILL_RADIUS}px;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
color: var(--lido-color-text);
|
|
82
|
+
font-family: inherit;
|
|
83
|
+
-webkit-tap-highlight-color: transparent;
|
|
84
|
+
position: relative;
|
|
85
|
+
z-index: 1;
|
|
86
|
+
|
|
87
|
+
&:hover ${SwitcherLabelStyle}, &:focus-visible ${SwitcherLabelStyle} {
|
|
88
|
+
opacity: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:disabled {
|
|
92
|
+
cursor: default;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:disabled ${SwitcherLabelStyle} {
|
|
96
|
+
opacity: 0.5;
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
export { SwitcherIndicatorStyle, SwitcherItemStyle, SwitcherLabelStyle, SwitcherListStyle };
|
|
101
|
+
//# sourceMappingURL=SwitcherStyles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitcherStyles.mjs","sources":["../../../packages/switcher/SwitcherStyles.tsx"],"sourcesContent":["import styled from '../utils/styled-components-wrapper.js'\n\ntype InjectedProps = {\n $active: boolean\n}\n\nconst CONTAINER_PADDING = 2\nconst ITEM_PADDING_Y = 2\nconst ITEM_PADDING_X = 12\nconst PILL_RADIUS = 110\n\nexport const SwitcherListStyle = styled.div`\n display: inline-flex;\n align-items: center;\n gap: 0;\n padding: ${CONTAINER_PADDING}px;\n background: var(--lido-color-backgroundDarken);\n border-radius: ${PILL_RADIUS}px;\n box-sizing: border-box;\n position: relative;\n\n --switcher-indicator-left: 0px;\n --switcher-indicator-width: 0px;\n`\n\nexport const SwitcherIndicatorStyle = styled.span`\n position: absolute;\n top: ${CONTAINER_PADDING}px;\n bottom: ${CONTAINER_PADDING}px;\n left: 0;\n width: var(--switcher-indicator-width, 0);\n background: var(--lido-color-foreground);\n border-radius: ${PILL_RADIUS}px;\n transition:\n transform ${({ theme }) => theme.duration.norm} ease,\n width ${({ theme }) => theme.duration.norm} ease;\n pointer-events: none;\n z-index: 0;\n will-change: transform, width;\n transform: translateX(var(--switcher-indicator-left, 0));\n`\n\nexport const SwitcherLabelStyle = styled.span<InjectedProps>`\n font-size: ${({ theme }) => theme.fontSizesMap.xxs}px;\n line-height: 20px;\n font-weight: 700;\n color: var(--lido-color-text);\n opacity: ${({ $active }) => ($active ? 1 : 0.5)};\n transition: opacity ${({ theme }) => theme.duration.fast} ease;\n white-space: nowrap;\n`\n\nexport const SwitcherItemStyle = styled.button<InjectedProps>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n border: none;\n background: transparent;\n padding: ${ITEM_PADDING_Y}px ${ITEM_PADDING_X}px;\n border-radius: ${PILL_RADIUS}px;\n box-sizing: border-box;\n cursor: pointer;\n color: var(--lido-color-text);\n font-family: inherit;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n z-index: 1;\n\n &:hover ${SwitcherLabelStyle}, &:focus-visible ${SwitcherLabelStyle} {\n opacity: 1;\n }\n\n &:disabled {\n cursor: default;\n }\n\n &:disabled ${SwitcherLabelStyle} {\n opacity: 0.5;\n }\n`\n"],"names":["CONTAINER_PADDING","ITEM_PADDING_Y","ITEM_PADDING_X","PILL_RADIUS","SwitcherListStyle","styled","div","SwitcherIndicatorStyle","span","_ref","theme","duration","norm","_ref2","SwitcherLabelStyle","_ref3","fontSizesMap","xxs","_ref4","$active","_ref5","fast","SwitcherItemStyle","button"],"mappings":";;AAMA,MAAMA,iBAAiB,GAAG,CAAC,CAAA;AAC3B,MAAMC,cAAc,GAAG,CAAC,CAAA;AACxB,MAAMC,cAAc,GAAG,EAAE,CAAA;AACzB,MAAMC,WAAW,GAAG,GAAG,CAAA;AAEVC,MAAAA,iBAAiB,GAAGC,MAAM,CAACC,GAAG,CAAA;AAC3C;AACA;AACA;AACA,WAAA,EAAaN,iBAAiB,CAAA;AAC9B;AACA,iBAAA,EAAmBG,WAAW,CAAA;AAC9B;AACA;AACA;AACA;AACA;AACA,EAAC;AAEYI,MAAAA,sBAAsB,GAAGF,MAAM,CAACG,IAAI,CAAA;AACjD;AACA,OAAA,EAASR,iBAAiB,CAAA;AAC1B,UAAA,EAAYA,iBAAiB,CAAA;AAC7B;AACA;AACA;AACA,iBAAA,EAAmBG,WAAW,CAAA;AAC9B;AACA,cAAA,EAAgBM,IAAA,IAAA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;AACA;AACA;AACA,aAAA,EAAeA,kBAAkB,CAAA;AACjC;AACA;AACA;;;;"}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { AccordionProps } from './types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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,
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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,
|
|
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/dist/types/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from './select/index.js';
|
|
|
27
27
|
export * from './service-page/index.js';
|
|
28
28
|
export * from './stack/index.js';
|
|
29
29
|
export * from './styled-system/index.js';
|
|
30
|
+
export * from './switcher/index.js';
|
|
30
31
|
export * from './table/index.js';
|
|
31
32
|
export * from './tabs/index.js';
|
|
32
33
|
export * from './text/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC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BAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Segmented control container for SwitcherItem options.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Switcher: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
children?: import("react").ReactNode;
|
|
7
|
+
} & Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
as?: keyof JSX.IntrinsicElements | undefined;
|
|
9
|
+
forwardedAs?: keyof JSX.IntrinsicElements | undefined;
|
|
10
|
+
}, "ref" | "children"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
//# sourceMappingURL=Switcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switcher.d.ts","sourceRoot":"","sources":["../../../packages/switcher/Switcher.tsx"],"names":[],"mappings":";AAKA;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;uEAwGpB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Switcher option button.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SwitcherItem: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
active?: boolean | undefined;
|
|
7
|
+
children?: import("react").ReactNode;
|
|
8
|
+
} & Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
as?: keyof JSX.IntrinsicElements | undefined;
|
|
10
|
+
forwardedAs?: keyof JSX.IntrinsicElements | undefined;
|
|
11
|
+
}, "ref" | "children" | "active"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
//# sourceMappingURL=SwitcherItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitcherItem.d.ts","sourceRoot":"","sources":["../../../packages/switcher/SwitcherItem.tsx"],"names":[],"mappings":";AAIA;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;qFAmBxB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare type InjectedProps = {
|
|
2
|
+
$active: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare const SwitcherListStyle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
export declare const SwitcherIndicatorStyle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const SwitcherLabelStyle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, InjectedProps, never>;
|
|
7
|
+
export declare const SwitcherItemStyle: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, InjectedProps, never>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=SwitcherStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitcherStyles.d.ts","sourceRoot":"","sources":["../../../packages/switcher/SwitcherStyles.tsx"],"names":[],"mappings":"AAEA,aAAK,aAAa,GAAG;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAOD,eAAO,MAAM,iBAAiB,yGAY7B,CAAA;AAED,eAAO,MAAM,sBAAsB,0GAelC,CAAA;AAED,eAAO,MAAM,kBAAkB,qHAQ9B,CAAA;AAED,eAAO,MAAM,iBAAiB,uHA4B7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/switcher/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LidoComponentProps } from '../utils';
|
|
3
|
+
export type { Theme } from '../theme/index.js';
|
|
4
|
+
export declare type SwitcherProps = LidoComponentProps<'div', {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
export declare type SwitcherItemProps = LidoComponentProps<'button', {
|
|
8
|
+
active?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../packages/switcher/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,oBAAY,aAAa,GAAG,kBAAkB,CAC5C,KAAK,EACL;IACE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CACF,CAAA;AAED,oBAAY,iBAAiB,GAAG,kBAAkB,CAChD,QAAQ,EACR;IACE,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lidofinance/lido-ui",
|
|
3
|
-
"version": "3.
|
|
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": "
|
|
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",
|