@lidofinance/lido-ui 3.41.0 → 3.42.0

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/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;
@@ -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","Swit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ACF,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;AAC1B,UAAA,EAAYA,iBAAiB,CAAA;AAC7B;AACA;AACA;AACA,iBAAA,EAAmBG,WAAW,CAAA;AAC9B;AACA,cAAA,EAAgBM,IAAA,IAAA;EAAA,IAAC;AA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A,aAAA,EAAeA,kBAAkB,CAAA;AACjC;AACA;AACA;;;;;;;"}
@@ -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';
@@ -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,yBAAyB,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,MAAM;AAC5B,MAAA,MAAMC,UAAU,GAAGH,QAAQ,CAACI,aAAa,CACvC,oCACF,CAAC,CAAA;M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AI,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;EAAA,IAAC;AAAEC,IAAAA,KAAAA;AAAM,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAKC,KAAK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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,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,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,i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rC,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,4 @@
1
+ export * from './Switcher.js';
2
+ export * from './SwitcherItem.js';
3
+ export * from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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.41.0",
3
+ "version": "3.42.0",
4
4
  "homepage": "https://github.com/lidofinance/ui",
5
5
  "repository": {
6
6
  "type": "git",