@rango-dev/ui 0.39.1-next.8 → 0.40.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/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/translations/de.d.ts.map +1 -1
- package/dist/translations/el.d.ts.map +1 -1
- package/dist/translations/en.d.ts.map +1 -1
- package/dist/translations/es.d.ts.map +1 -1
- package/dist/translations/fi.d.ts.map +1 -1
- package/dist/translations/fr.d.ts.map +1 -1
- package/dist/translations/it.d.ts.map +1 -1
- package/dist/translations/ja.d.ts.map +1 -1
- package/dist/translations/nl.d.ts.map +1 -1
- package/dist/translations/pl.d.ts.map +1 -1
- package/dist/translations/pt.d.ts.map +1 -1
- package/dist/translations/ru.d.ts.map +1 -1
- package/dist/translations/sv.d.ts.map +1 -1
- package/dist/translations/uk.d.ts.map +1 -1
- package/dist/translations/zh.d.ts.map +1 -1
- package/dist/ui.build.json +1 -1
- package/dist/widget/ui/src/components/Tabs/Tabs.d.ts.map +1 -1
- package/package.json +3 -3
- package/readme.md +1 -1
- package/src/components/Tabs/Tabs.tsx +52 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgB3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgB3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,qBA8MjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@radix-ui/react-select": "^2.0.0",
|
|
54
54
|
"@radix-ui/react-switch": "^1.0.1",
|
|
55
55
|
"@radix-ui/react-tooltip": "^1.0.2",
|
|
56
|
-
"@rango-dev/wallets-shared": "^0.
|
|
56
|
+
"@rango-dev/wallets-shared": "^0.38.0",
|
|
57
57
|
"@stitches/react": "^1.2.8",
|
|
58
58
|
"copy-to-clipboard": "^3.3.3",
|
|
59
59
|
"rango-types": "^0.1.74",
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|
package/readme.md
CHANGED
|
@@ -61,14 +61,12 @@ export function TabsComponent(props: TabsPropTypes) {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
const updateIndicator = (
|
|
64
|
+
const updateIndicator = () => {
|
|
65
65
|
if (tabRef.current && containerRef.current) {
|
|
66
66
|
const tabRect = tabRef.current.getBoundingClientRect();
|
|
67
67
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
68
68
|
setTabWidth(tabRect.width);
|
|
69
|
-
setTransformPosition(
|
|
70
|
-
scrollable ? tabRef.current.offsetLeft : currentIndex * tabWidth
|
|
71
|
-
);
|
|
69
|
+
setTransformPosition(tabRef.current.offsetLeft);
|
|
72
70
|
const itemPartiallyVisibleOnLeft = tabRect.left < containerRect.left;
|
|
73
71
|
const itemPartiallyVisibleOnRight = tabRect.right > containerRect.right;
|
|
74
72
|
|
|
@@ -96,7 +94,7 @@ export function TabsComponent(props: TabsPropTypes) {
|
|
|
96
94
|
}, []);
|
|
97
95
|
|
|
98
96
|
useEffect(() => {
|
|
99
|
-
updateIndicator(
|
|
97
|
+
updateIndicator();
|
|
100
98
|
|
|
101
99
|
const updateArrowsVisibility = () => {
|
|
102
100
|
if (scrollable && containerRef.current) {
|
|
@@ -119,20 +117,23 @@ export function TabsComponent(props: TabsPropTypes) {
|
|
|
119
117
|
};
|
|
120
118
|
|
|
121
119
|
const resizeHandler: ResizeObserverCallback = (event) => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
120
|
+
updateIndicator();
|
|
121
|
+
|
|
122
|
+
if (!containerRef.current || !scrollable || !scrollButtons) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
updateArrowsVisibility();
|
|
127
|
+
|
|
128
|
+
const TOTAL_WIDTH_OF_ARROWS = 64;
|
|
129
|
+
const element = event[0].target;
|
|
130
|
+
const tabsContainerOverflown =
|
|
131
|
+
element.scrollWidth - TOTAL_WIDTH_OF_ARROWS > element.clientWidth;
|
|
132
|
+
|
|
133
|
+
if (showArrows && !tabsContainerOverflown) {
|
|
134
|
+
setShowArrows(false);
|
|
135
|
+
} else if (element.scrollWidth > element.clientWidth) {
|
|
136
|
+
setShowArrows(true);
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
139
|
|
|
@@ -177,34 +178,38 @@ export function TabsComponent(props: TabsPropTypes) {
|
|
|
177
178
|
type={type}
|
|
178
179
|
borderRadius={borderRadius}
|
|
179
180
|
scrollable={scrollable}>
|
|
180
|
-
{tabItems.map((item, index) =>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
181
|
+
{tabItems.map((item, index) => {
|
|
182
|
+
const isActive = item.id === value;
|
|
183
|
+
return (
|
|
184
|
+
<Tooltip
|
|
185
|
+
key={item.id}
|
|
186
|
+
styles={{ root: { width: '100%' } }}
|
|
187
|
+
container={container}
|
|
188
|
+
side="bottom"
|
|
189
|
+
sideOffset={2}
|
|
190
|
+
content={item.tooltip}
|
|
191
|
+
open={!item.tooltip ? false : undefined}>
|
|
192
|
+
<Tab
|
|
193
|
+
className="_tab"
|
|
194
|
+
ref={index === currentIndex ? tabRef : null}
|
|
195
|
+
type={type}
|
|
196
|
+
fullWidth={scrollable ? false : true}
|
|
197
|
+
disableRipple={true}
|
|
198
|
+
borderRadius={borderRadius}
|
|
199
|
+
onClick={() => onChange(item)}
|
|
200
|
+
size="small"
|
|
201
|
+
isActive={isActive}
|
|
202
|
+
data-active={isActive}
|
|
203
|
+
variant="default">
|
|
204
|
+
{item.icon}
|
|
205
|
+
{!!item.icon && !!item.title && (
|
|
206
|
+
<Divider direction="horizontal" size="2" />
|
|
207
|
+
)}
|
|
208
|
+
{item.title}
|
|
209
|
+
</Tab>
|
|
210
|
+
</Tooltip>
|
|
211
|
+
);
|
|
212
|
+
})}
|
|
208
213
|
<BackdropTab
|
|
209
214
|
type={type}
|
|
210
215
|
borderRadius={borderRadius}
|