@uipath/apollo-wind 2.24.0 → 2.25.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/components/ui/index.cjs +16 -16
- package/dist/components/ui/tabs.cjs +125 -0
- package/dist/components/ui/tabs.d.ts +9 -1
- package/dist/components/ui/tabs.js +125 -3
- package/dist/index.cjs +4 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/styles.css +8 -0
- package/package.json +1 -1
|
@@ -33,19 +33,19 @@ var __webpack_modules__ = {
|
|
|
33
33
|
"./card" (module) {
|
|
34
34
|
module.exports = require("./card.cjs");
|
|
35
35
|
},
|
|
36
|
-
"
|
|
36
|
+
"@/components/ui/checkbox" (module) {
|
|
37
37
|
module.exports = require("./checkbox.cjs");
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"./collapsible" (module) {
|
|
40
40
|
module.exports = require("./collapsible.cjs");
|
|
41
41
|
},
|
|
42
42
|
"./combobox" (module) {
|
|
43
43
|
module.exports = require("./combobox.cjs");
|
|
44
44
|
},
|
|
45
|
-
"
|
|
45
|
+
"@/components/ui/command" (module) {
|
|
46
46
|
module.exports = require("./command.cjs");
|
|
47
47
|
},
|
|
48
|
-
"
|
|
48
|
+
"./context-menu" (module) {
|
|
49
49
|
module.exports = require("./context-menu.cjs");
|
|
50
50
|
},
|
|
51
51
|
"./data-table" (module) {
|
|
@@ -60,7 +60,7 @@ var __webpack_modules__ = {
|
|
|
60
60
|
"@/components/ui/dialog" (module) {
|
|
61
61
|
module.exports = require("./dialog.cjs");
|
|
62
62
|
},
|
|
63
|
-
"
|
|
63
|
+
"./dropdown-menu" (module) {
|
|
64
64
|
module.exports = require("./dropdown-menu.cjs");
|
|
65
65
|
},
|
|
66
66
|
"@/components/ui/editable-cell" (module) {
|
|
@@ -72,7 +72,7 @@ var __webpack_modules__ = {
|
|
|
72
72
|
"./file-upload" (module) {
|
|
73
73
|
module.exports = require("./file-upload.cjs");
|
|
74
74
|
},
|
|
75
|
-
"
|
|
75
|
+
"./hover-card" (module) {
|
|
76
76
|
module.exports = require("./hover-card.cjs");
|
|
77
77
|
},
|
|
78
78
|
"./input" (module) {
|
|
@@ -90,7 +90,7 @@ var __webpack_modules__ = {
|
|
|
90
90
|
"./pagination" (module) {
|
|
91
91
|
module.exports = require("./pagination.cjs");
|
|
92
92
|
},
|
|
93
|
-
"
|
|
93
|
+
"@/components/ui/popover" (module) {
|
|
94
94
|
module.exports = require("./popover.cjs");
|
|
95
95
|
},
|
|
96
96
|
"./progress" (module) {
|
|
@@ -153,7 +153,7 @@ var __webpack_modules__ = {
|
|
|
153
153
|
"./toggle-group" (module) {
|
|
154
154
|
module.exports = require("./toggle-group.cjs");
|
|
155
155
|
},
|
|
156
|
-
"
|
|
156
|
+
"@/components/ui/toggle" (module) {
|
|
157
157
|
module.exports = require("./toggle.cjs");
|
|
158
158
|
},
|
|
159
159
|
"./tooltip" (module) {
|
|
@@ -286,14 +286,14 @@ var __webpack_exports__ = {};
|
|
|
286
286
|
"default"
|
|
287
287
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_card__rspack_import_10[__rspack_import_key];
|
|
288
288
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
289
|
-
var _checkbox__rspack_import_11 = __webpack_require__("
|
|
289
|
+
var _checkbox__rspack_import_11 = __webpack_require__("@/components/ui/checkbox");
|
|
290
290
|
var __rspack_reexport = {};
|
|
291
291
|
for(const __rspack_import_key in _checkbox__rspack_import_11)if ([
|
|
292
292
|
"TreeView",
|
|
293
293
|
"default"
|
|
294
294
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_checkbox__rspack_import_11[__rspack_import_key];
|
|
295
295
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
296
|
-
var _collapsible__rspack_import_12 = __webpack_require__("
|
|
296
|
+
var _collapsible__rspack_import_12 = __webpack_require__("./collapsible");
|
|
297
297
|
var __rspack_reexport = {};
|
|
298
298
|
for(const __rspack_import_key in _collapsible__rspack_import_12)if ([
|
|
299
299
|
"TreeView",
|
|
@@ -307,14 +307,14 @@ var __webpack_exports__ = {};
|
|
|
307
307
|
"default"
|
|
308
308
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_combobox__rspack_import_13[__rspack_import_key];
|
|
309
309
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
310
|
-
var _command__rspack_import_14 = __webpack_require__("
|
|
310
|
+
var _command__rspack_import_14 = __webpack_require__("@/components/ui/command");
|
|
311
311
|
var __rspack_reexport = {};
|
|
312
312
|
for(const __rspack_import_key in _command__rspack_import_14)if ([
|
|
313
313
|
"TreeView",
|
|
314
314
|
"default"
|
|
315
315
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_command__rspack_import_14[__rspack_import_key];
|
|
316
316
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
317
|
-
var _context_menu__rspack_import_15 = __webpack_require__("
|
|
317
|
+
var _context_menu__rspack_import_15 = __webpack_require__("./context-menu");
|
|
318
318
|
var __rspack_reexport = {};
|
|
319
319
|
for(const __rspack_import_key in _context_menu__rspack_import_15)if ([
|
|
320
320
|
"TreeView",
|
|
@@ -349,7 +349,7 @@ var __webpack_exports__ = {};
|
|
|
349
349
|
"default"
|
|
350
350
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_dialog__rspack_import_19[__rspack_import_key];
|
|
351
351
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
352
|
-
var _dropdown_menu__rspack_import_20 = __webpack_require__("
|
|
352
|
+
var _dropdown_menu__rspack_import_20 = __webpack_require__("./dropdown-menu");
|
|
353
353
|
var __rspack_reexport = {};
|
|
354
354
|
for(const __rspack_import_key in _dropdown_menu__rspack_import_20)if ([
|
|
355
355
|
"TreeView",
|
|
@@ -377,7 +377,7 @@ var __webpack_exports__ = {};
|
|
|
377
377
|
"default"
|
|
378
378
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_file_upload__rspack_import_23[__rspack_import_key];
|
|
379
379
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
380
|
-
var _hover_card__rspack_import_24 = __webpack_require__("
|
|
380
|
+
var _hover_card__rspack_import_24 = __webpack_require__("./hover-card");
|
|
381
381
|
var __rspack_reexport = {};
|
|
382
382
|
for(const __rspack_import_key in _hover_card__rspack_import_24)if ([
|
|
383
383
|
"TreeView",
|
|
@@ -419,7 +419,7 @@ var __webpack_exports__ = {};
|
|
|
419
419
|
"default"
|
|
420
420
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_pagination__rspack_import_29[__rspack_import_key];
|
|
421
421
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
422
|
-
var _popover__rspack_import_30 = __webpack_require__("
|
|
422
|
+
var _popover__rspack_import_30 = __webpack_require__("@/components/ui/popover");
|
|
423
423
|
var __rspack_reexport = {};
|
|
424
424
|
for(const __rspack_import_key in _popover__rspack_import_30)if ([
|
|
425
425
|
"TreeView",
|
|
@@ -559,7 +559,7 @@ var __webpack_exports__ = {};
|
|
|
559
559
|
"default"
|
|
560
560
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_textarea__rspack_import_49[__rspack_import_key];
|
|
561
561
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
562
|
-
var _toggle__rspack_import_50 = __webpack_require__("
|
|
562
|
+
var _toggle__rspack_import_50 = __webpack_require__("@/components/ui/toggle");
|
|
563
563
|
var __rspack_reexport = {};
|
|
564
564
|
for(const __rspack_import_key in _toggle__rspack_import_50)if ([
|
|
565
565
|
"TreeView",
|
|
@@ -24,6 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ScrollableTabsList: ()=>ScrollableTabsList,
|
|
27
28
|
TabsList: ()=>TabsList,
|
|
28
29
|
Tabs: ()=>Tabs,
|
|
29
30
|
TabsTrigger: ()=>TabsTrigger,
|
|
@@ -31,6 +32,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
32
|
});
|
|
32
33
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
34
|
const react_tabs_namespaceObject = require("@radix-ui/react-tabs");
|
|
35
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
34
36
|
const external_react_namespaceObject = require("react");
|
|
35
37
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
36
38
|
const Tabs = react_tabs_namespaceObject.Root;
|
|
@@ -40,6 +42,127 @@ const TabsList = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ clas
|
|
|
40
42
|
...props
|
|
41
43
|
}));
|
|
42
44
|
TabsList.displayName = react_tabs_namespaceObject.List.displayName;
|
|
45
|
+
const ScrollableTabsList = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, containerClassName, scrollButtonClassName, previousButtonLabel = 'Scroll tabs left', nextButtonLabel = 'Scroll tabs right', ...props }, forwardedRef)=>{
|
|
46
|
+
const listRef = external_react_namespaceObject.useRef(null);
|
|
47
|
+
const [hasOverflow, setHasOverflow] = external_react_namespaceObject.useState(false);
|
|
48
|
+
const [canScrollLeft, setCanScrollLeft] = external_react_namespaceObject.useState(false);
|
|
49
|
+
const [canScrollRight, setCanScrollRight] = external_react_namespaceObject.useState(false);
|
|
50
|
+
const animationFrameRef = external_react_namespaceObject.useRef(null);
|
|
51
|
+
const revealOnNextFrameRef = external_react_namespaceObject.useRef(false);
|
|
52
|
+
external_react_namespaceObject.useImperativeHandle(forwardedRef, ()=>listRef.current);
|
|
53
|
+
const updateScrollState = external_react_namespaceObject.useCallback(()=>{
|
|
54
|
+
const list = listRef.current;
|
|
55
|
+
if (!list) return;
|
|
56
|
+
const maxScrollLeft = list.scrollWidth - list.clientWidth;
|
|
57
|
+
setHasOverflow(maxScrollLeft > 1);
|
|
58
|
+
setCanScrollLeft(list.scrollLeft > 1);
|
|
59
|
+
setCanScrollRight(list.scrollLeft < maxScrollLeft - 1);
|
|
60
|
+
}, []);
|
|
61
|
+
const revealActiveTab = external_react_namespaceObject.useCallback(()=>{
|
|
62
|
+
const list = listRef.current;
|
|
63
|
+
const activeTab = list?.querySelector('[role="tab"][data-state="active"]');
|
|
64
|
+
if (!list || !activeTab) return;
|
|
65
|
+
const listRect = list.getBoundingClientRect();
|
|
66
|
+
const activeTabRect = activeTab.getBoundingClientRect();
|
|
67
|
+
if (activeTabRect.left < listRect.left) list.scrollBy({
|
|
68
|
+
left: activeTabRect.left - listRect.left,
|
|
69
|
+
behavior: 'smooth'
|
|
70
|
+
});
|
|
71
|
+
else if (activeTabRect.right > listRect.right) list.scrollBy({
|
|
72
|
+
left: activeTabRect.right - listRect.right,
|
|
73
|
+
behavior: 'smooth'
|
|
74
|
+
});
|
|
75
|
+
}, []);
|
|
76
|
+
const scheduleLayoutUpdate = external_react_namespaceObject.useCallback((revealActive = false)=>{
|
|
77
|
+
revealOnNextFrameRef.current ||= revealActive;
|
|
78
|
+
if (null !== animationFrameRef.current) return;
|
|
79
|
+
animationFrameRef.current = requestAnimationFrame(()=>{
|
|
80
|
+
animationFrameRef.current = null;
|
|
81
|
+
updateScrollState();
|
|
82
|
+
if (revealOnNextFrameRef.current) {
|
|
83
|
+
revealOnNextFrameRef.current = false;
|
|
84
|
+
revealActiveTab();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}, [
|
|
88
|
+
revealActiveTab,
|
|
89
|
+
updateScrollState
|
|
90
|
+
]);
|
|
91
|
+
external_react_namespaceObject.useEffect(()=>{
|
|
92
|
+
const list = listRef.current;
|
|
93
|
+
if (!list) return;
|
|
94
|
+
list.scrollLeft = 0;
|
|
95
|
+
scheduleLayoutUpdate(true);
|
|
96
|
+
const handleScroll = ()=>scheduleLayoutUpdate();
|
|
97
|
+
list.addEventListener('scroll', handleScroll);
|
|
98
|
+
const resizeObserver = new ResizeObserver(()=>scheduleLayoutUpdate(true));
|
|
99
|
+
resizeObserver.observe(list);
|
|
100
|
+
const mutationObserver = new MutationObserver((mutations)=>{
|
|
101
|
+
if (mutations.some((mutation)=>'childList' === mutation.type || 'data-state' === mutation.attributeName)) scheduleLayoutUpdate(true);
|
|
102
|
+
});
|
|
103
|
+
mutationObserver.observe(list, {
|
|
104
|
+
attributes: true,
|
|
105
|
+
attributeFilter: [
|
|
106
|
+
'data-state'
|
|
107
|
+
],
|
|
108
|
+
childList: true,
|
|
109
|
+
subtree: true
|
|
110
|
+
});
|
|
111
|
+
return ()=>{
|
|
112
|
+
list.removeEventListener('scroll', handleScroll);
|
|
113
|
+
resizeObserver.disconnect();
|
|
114
|
+
mutationObserver.disconnect();
|
|
115
|
+
if (null !== animationFrameRef.current) {
|
|
116
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
117
|
+
animationFrameRef.current = null;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}, [
|
|
121
|
+
scheduleLayoutUpdate
|
|
122
|
+
]);
|
|
123
|
+
const scroll = (direction)=>{
|
|
124
|
+
const list = listRef.current;
|
|
125
|
+
if (!list) return;
|
|
126
|
+
list.scrollBy({
|
|
127
|
+
left: 'left' === direction ? -list.clientWidth : list.clientWidth,
|
|
128
|
+
behavior: 'smooth'
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
const scrollButtonClass = (0, index_cjs_namespaceObject.cn)('grid size-8 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-30', scrollButtonClassName);
|
|
132
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
133
|
+
className: (0, index_cjs_namespaceObject.cn)('flex w-full min-w-0 items-center gap-1', containerClassName),
|
|
134
|
+
children: [
|
|
135
|
+
hasOverflow && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
"aria-label": previousButtonLabel,
|
|
138
|
+
title: previousButtonLabel,
|
|
139
|
+
disabled: !canScrollLeft,
|
|
140
|
+
onClick: ()=>scroll('left'),
|
|
141
|
+
className: scrollButtonClass,
|
|
142
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronLeft, {
|
|
143
|
+
className: "size-4 rtl:rotate-180"
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabsList, {
|
|
147
|
+
ref: listRef,
|
|
148
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0 flex-1 justify-start overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden', className),
|
|
149
|
+
...props
|
|
150
|
+
}),
|
|
151
|
+
hasOverflow && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
152
|
+
type: "button",
|
|
153
|
+
"aria-label": nextButtonLabel,
|
|
154
|
+
title: nextButtonLabel,
|
|
155
|
+
disabled: !canScrollRight,
|
|
156
|
+
onClick: ()=>scroll('right'),
|
|
157
|
+
className: scrollButtonClass,
|
|
158
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronRight, {
|
|
159
|
+
className: "size-4 rtl:rotate-180"
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
ScrollableTabsList.displayName = 'ScrollableTabsList';
|
|
43
166
|
const TabsTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_tabs_namespaceObject.Trigger, {
|
|
44
167
|
ref: ref,
|
|
45
168
|
className: (0, index_cjs_namespaceObject.cn)('inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm', className),
|
|
@@ -52,11 +175,13 @@ const TabsContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ c
|
|
|
52
175
|
...props
|
|
53
176
|
}));
|
|
54
177
|
TabsContent.displayName = react_tabs_namespaceObject.Content.displayName;
|
|
178
|
+
exports.ScrollableTabsList = __webpack_exports__.ScrollableTabsList;
|
|
55
179
|
exports.Tabs = __webpack_exports__.Tabs;
|
|
56
180
|
exports.TabsContent = __webpack_exports__.TabsContent;
|
|
57
181
|
exports.TabsList = __webpack_exports__.TabsList;
|
|
58
182
|
exports.TabsTrigger = __webpack_exports__.TabsTrigger;
|
|
59
183
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
184
|
+
"ScrollableTabsList",
|
|
60
185
|
"Tabs",
|
|
61
186
|
"TabsContent",
|
|
62
187
|
"TabsList",
|
|
@@ -2,6 +2,14 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
interface ScrollableTabsListProps extends React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> {
|
|
6
|
+
containerClassName?: string;
|
|
7
|
+
scrollButtonClassName?: string;
|
|
8
|
+
previousButtonLabel?: string;
|
|
9
|
+
nextButtonLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const ScrollableTabsList: React.ForwardRefExoticComponent<ScrollableTabsListProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
12
|
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
13
|
declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
-
export { Tabs, TabsList, TabsTrigger
|
|
14
|
+
export { ScrollableTabsList, Tabs, TabsContent, TabsList, TabsTrigger };
|
|
15
|
+
export type { ScrollableTabsListProps };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Content, List, Root, Trigger } from "@radix-ui/react-tabs";
|
|
3
|
-
import {
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
4
5
|
import { cn } from "../../lib/index.js";
|
|
5
6
|
const Tabs = Root;
|
|
6
7
|
const TabsList = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(List, {
|
|
@@ -9,6 +10,127 @@ const TabsList = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__P
|
|
|
9
10
|
...props
|
|
10
11
|
}));
|
|
11
12
|
TabsList.displayName = List.displayName;
|
|
13
|
+
const ScrollableTabsList = /*#__PURE__*/ forwardRef(({ className, containerClassName, scrollButtonClassName, previousButtonLabel = 'Scroll tabs left', nextButtonLabel = 'Scroll tabs right', ...props }, forwardedRef)=>{
|
|
14
|
+
const listRef = useRef(null);
|
|
15
|
+
const [hasOverflow, setHasOverflow] = useState(false);
|
|
16
|
+
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
17
|
+
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
18
|
+
const animationFrameRef = useRef(null);
|
|
19
|
+
const revealOnNextFrameRef = useRef(false);
|
|
20
|
+
useImperativeHandle(forwardedRef, ()=>listRef.current);
|
|
21
|
+
const updateScrollState = useCallback(()=>{
|
|
22
|
+
const list = listRef.current;
|
|
23
|
+
if (!list) return;
|
|
24
|
+
const maxScrollLeft = list.scrollWidth - list.clientWidth;
|
|
25
|
+
setHasOverflow(maxScrollLeft > 1);
|
|
26
|
+
setCanScrollLeft(list.scrollLeft > 1);
|
|
27
|
+
setCanScrollRight(list.scrollLeft < maxScrollLeft - 1);
|
|
28
|
+
}, []);
|
|
29
|
+
const revealActiveTab = useCallback(()=>{
|
|
30
|
+
const list = listRef.current;
|
|
31
|
+
const activeTab = list?.querySelector('[role="tab"][data-state="active"]');
|
|
32
|
+
if (!list || !activeTab) return;
|
|
33
|
+
const listRect = list.getBoundingClientRect();
|
|
34
|
+
const activeTabRect = activeTab.getBoundingClientRect();
|
|
35
|
+
if (activeTabRect.left < listRect.left) list.scrollBy({
|
|
36
|
+
left: activeTabRect.left - listRect.left,
|
|
37
|
+
behavior: 'smooth'
|
|
38
|
+
});
|
|
39
|
+
else if (activeTabRect.right > listRect.right) list.scrollBy({
|
|
40
|
+
left: activeTabRect.right - listRect.right,
|
|
41
|
+
behavior: 'smooth'
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
const scheduleLayoutUpdate = useCallback((revealActive = false)=>{
|
|
45
|
+
revealOnNextFrameRef.current ||= revealActive;
|
|
46
|
+
if (null !== animationFrameRef.current) return;
|
|
47
|
+
animationFrameRef.current = requestAnimationFrame(()=>{
|
|
48
|
+
animationFrameRef.current = null;
|
|
49
|
+
updateScrollState();
|
|
50
|
+
if (revealOnNextFrameRef.current) {
|
|
51
|
+
revealOnNextFrameRef.current = false;
|
|
52
|
+
revealActiveTab();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}, [
|
|
56
|
+
revealActiveTab,
|
|
57
|
+
updateScrollState
|
|
58
|
+
]);
|
|
59
|
+
useEffect(()=>{
|
|
60
|
+
const list = listRef.current;
|
|
61
|
+
if (!list) return;
|
|
62
|
+
list.scrollLeft = 0;
|
|
63
|
+
scheduleLayoutUpdate(true);
|
|
64
|
+
const handleScroll = ()=>scheduleLayoutUpdate();
|
|
65
|
+
list.addEventListener('scroll', handleScroll);
|
|
66
|
+
const resizeObserver = new ResizeObserver(()=>scheduleLayoutUpdate(true));
|
|
67
|
+
resizeObserver.observe(list);
|
|
68
|
+
const mutationObserver = new MutationObserver((mutations)=>{
|
|
69
|
+
if (mutations.some((mutation)=>'childList' === mutation.type || 'data-state' === mutation.attributeName)) scheduleLayoutUpdate(true);
|
|
70
|
+
});
|
|
71
|
+
mutationObserver.observe(list, {
|
|
72
|
+
attributes: true,
|
|
73
|
+
attributeFilter: [
|
|
74
|
+
'data-state'
|
|
75
|
+
],
|
|
76
|
+
childList: true,
|
|
77
|
+
subtree: true
|
|
78
|
+
});
|
|
79
|
+
return ()=>{
|
|
80
|
+
list.removeEventListener('scroll', handleScroll);
|
|
81
|
+
resizeObserver.disconnect();
|
|
82
|
+
mutationObserver.disconnect();
|
|
83
|
+
if (null !== animationFrameRef.current) {
|
|
84
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
85
|
+
animationFrameRef.current = null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}, [
|
|
89
|
+
scheduleLayoutUpdate
|
|
90
|
+
]);
|
|
91
|
+
const scroll = (direction)=>{
|
|
92
|
+
const list = listRef.current;
|
|
93
|
+
if (!list) return;
|
|
94
|
+
list.scrollBy({
|
|
95
|
+
left: 'left' === direction ? -list.clientWidth : list.clientWidth,
|
|
96
|
+
behavior: 'smooth'
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const scrollButtonClass = cn('grid size-8 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-30', scrollButtonClassName);
|
|
100
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
101
|
+
className: cn('flex w-full min-w-0 items-center gap-1', containerClassName),
|
|
102
|
+
children: [
|
|
103
|
+
hasOverflow && /*#__PURE__*/ jsx("button", {
|
|
104
|
+
type: "button",
|
|
105
|
+
"aria-label": previousButtonLabel,
|
|
106
|
+
title: previousButtonLabel,
|
|
107
|
+
disabled: !canScrollLeft,
|
|
108
|
+
onClick: ()=>scroll('left'),
|
|
109
|
+
className: scrollButtonClass,
|
|
110
|
+
children: /*#__PURE__*/ jsx(ChevronLeft, {
|
|
111
|
+
className: "size-4 rtl:rotate-180"
|
|
112
|
+
})
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ jsx(TabsList, {
|
|
115
|
+
ref: listRef,
|
|
116
|
+
className: cn('min-w-0 flex-1 justify-start overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden', className),
|
|
117
|
+
...props
|
|
118
|
+
}),
|
|
119
|
+
hasOverflow && /*#__PURE__*/ jsx("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
"aria-label": nextButtonLabel,
|
|
122
|
+
title: nextButtonLabel,
|
|
123
|
+
disabled: !canScrollRight,
|
|
124
|
+
onClick: ()=>scroll('right'),
|
|
125
|
+
className: scrollButtonClass,
|
|
126
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {
|
|
127
|
+
className: "size-4 rtl:rotate-180"
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
ScrollableTabsList.displayName = 'ScrollableTabsList';
|
|
12
134
|
const TabsTrigger = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Trigger, {
|
|
13
135
|
ref: ref,
|
|
14
136
|
className: cn('inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm', className),
|
|
@@ -21,4 +143,4 @@ const TabsContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#
|
|
|
21
143
|
...props
|
|
22
144
|
}));
|
|
23
145
|
TabsContent.displayName = Content.displayName;
|
|
24
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger };
|
|
146
|
+
export { ScrollableTabsList, Tabs, TabsContent, TabsList, TabsTrigger };
|
package/dist/index.cjs
CHANGED
|
@@ -68,8 +68,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
68
68
|
FormFieldRenderer: ()=>field_renderer_cjs_namespaceObject.FormFieldRenderer,
|
|
69
69
|
EditableCell: ()=>editable_cell_cjs_namespaceObject.EditableCell,
|
|
70
70
|
PromptEditor: ()=>index_cjs_namespaceObject.PromptEditor,
|
|
71
|
+
ScrollableTabsList: ()=>tabs_cjs_namespaceObject.ScrollableTabsList,
|
|
71
72
|
Spinner: ()=>spinner_cjs_namespaceObject.Spinner,
|
|
72
|
-
buttonVariants: ()=>button_cjs_namespaceObject.buttonVariants,
|
|
73
73
|
SheetOverlay: ()=>sheet_cjs_namespaceObject.SheetOverlay,
|
|
74
74
|
AlertDialogPortal: ()=>alert_dialog_cjs_namespaceObject.AlertDialogPortal,
|
|
75
75
|
DropdownMenuGroup: ()=>dropdown_menu_cjs_namespaceObject.DropdownMenuGroup,
|
|
@@ -77,6 +77,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
77
77
|
TabsList: ()=>tabs_cjs_namespaceObject.TabsList,
|
|
78
78
|
ContextMenuItem: ()=>context_menu_cjs_namespaceObject.ContextMenuItem,
|
|
79
79
|
TooltipContent: ()=>tooltip_cjs_namespaceObject.TooltipContent,
|
|
80
|
+
buttonVariants: ()=>button_cjs_namespaceObject.buttonVariants,
|
|
80
81
|
TableBody: ()=>table_cjs_namespaceObject.TableBody,
|
|
81
82
|
AvatarImage: ()=>avatar_cjs_namespaceObject.AvatarImage,
|
|
82
83
|
RuleBuilder: ()=>rules_engine_cjs_namespaceObject.RuleBuilder,
|
|
@@ -456,6 +457,7 @@ exports.RuleBuilder = __webpack_exports__.RuleBuilder;
|
|
|
456
457
|
exports.RulesEngine = __webpack_exports__.RulesEngine;
|
|
457
458
|
exports.ScrollArea = __webpack_exports__.ScrollArea;
|
|
458
459
|
exports.ScrollBar = __webpack_exports__.ScrollBar;
|
|
460
|
+
exports.ScrollableTabsList = __webpack_exports__.ScrollableTabsList;
|
|
459
461
|
exports.Search = __webpack_exports__.Search;
|
|
460
462
|
exports.SearchWithSuggestions = __webpack_exports__.SearchWithSuggestions;
|
|
461
463
|
exports.Select = __webpack_exports__.Select;
|
|
@@ -670,6 +672,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
670
672
|
"RulesEngine",
|
|
671
673
|
"ScrollArea",
|
|
672
674
|
"ScrollBar",
|
|
675
|
+
"ScrollableTabsList",
|
|
673
676
|
"Search",
|
|
674
677
|
"SearchWithSuggestions",
|
|
675
678
|
"Select",
|
package/dist/index.d.ts
CHANGED
|
@@ -61,7 +61,8 @@ export { Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger
|
|
|
61
61
|
export { HoverCard, HoverCardContent, HoverCardTrigger, } from './components/ui/hover-card';
|
|
62
62
|
export { Alert, AlertDescription, AlertTitle } from './components/ui/alert';
|
|
63
63
|
export { toast, Toaster } from './components/ui/sonner';
|
|
64
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger } from './components/ui/tabs';
|
|
64
|
+
export { ScrollableTabsList, Tabs, TabsContent, TabsList, TabsTrigger, } from './components/ui/tabs';
|
|
65
|
+
export type { ScrollableTabsListProps } from './components/ui/tabs';
|
|
65
66
|
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from './components/ui/breadcrumb';
|
|
66
67
|
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, } from './components/ui/pagination';
|
|
67
68
|
export { Stepper } from './components/ui/stepper';
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import { Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger
|
|
|
42
42
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/ui/hover-card.js";
|
|
43
43
|
import { Alert, AlertDescription, AlertTitle } from "./components/ui/alert.js";
|
|
44
44
|
import { Toaster, toast } from "./components/ui/sonner.js";
|
|
45
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs.js";
|
|
45
|
+
import { ScrollableTabsList, Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs.js";
|
|
46
46
|
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/ui/breadcrumb.js";
|
|
47
47
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "./components/ui/pagination.js";
|
|
48
48
|
import { Stepper } from "./components/ui/stepper.js";
|
|
@@ -63,4 +63,4 @@ import { ExpressionBuilder, RuleBuilder, RulesEngine } from "./components/forms/
|
|
|
63
63
|
import { DataFetcher, DataSourceBuilder, DataTransformers, FetchAdapter } from "./components/forms/data-fetcher.js";
|
|
64
64
|
import { analyticsPlugin, auditPlugin, autoSavePlugin, formattingPlugin, validationPlugin, workflowPlugin } from "./components/forms/form-plugins.js";
|
|
65
65
|
import { hasMinMaxStep, hasOptions, isCustomField, isFileField } from "./components/forms/form-schema.js";
|
|
66
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataFetcher, DataSourceBuilder, DataTable, DataTableColumnHeader, DataTableSelectColumn, DataTransformers, DatePicker, DateTimePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableCell, EmptyState, ExpressionBuilder, FetchAdapter, FileUpload, FormDesigner, FormFieldRenderer, FormStateViewer, Grid, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, MetadataForm, MultiSelect, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, PromptEditor, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Row, RuleBuilder, RulesEngine, ScrollArea, ScrollBar, Search, SearchWithSuggestions, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, Spinner, StatsCard, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, tree_view as TreeView, VARIABLE_DRAG_MIME, analyticsPlugin, auditPlugin, autoSavePlugin, badgeVariants, buttonVariants, cn, createEditableColumn, formattingPlugin, hasMinMaxStep, hasOptions, isCustomField, isFileField, spinnerVariants, toast, toggleVariants, validationPlugin, workflowPlugin };
|
|
66
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataFetcher, DataSourceBuilder, DataTable, DataTableColumnHeader, DataTableSelectColumn, DataTransformers, DatePicker, DateTimePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableCell, EmptyState, ExpressionBuilder, FetchAdapter, FileUpload, FormDesigner, FormFieldRenderer, FormStateViewer, Grid, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, MetadataForm, MultiSelect, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, PromptEditor, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Row, RuleBuilder, RulesEngine, ScrollArea, ScrollBar, ScrollableTabsList, Search, SearchWithSuggestions, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, Spinner, StatsCard, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, tree_view as TreeView, VARIABLE_DRAG_MIME, analyticsPlugin, auditPlugin, autoSavePlugin, badgeVariants, buttonVariants, cn, createEditableColumn, formattingPlugin, hasMinMaxStep, hasOptions, isCustomField, isFileField, spinnerVariants, toast, toggleVariants, validationPlugin, workflowPlugin };
|
package/dist/styles.css
CHANGED
|
@@ -1713,6 +1713,9 @@
|
|
|
1713
1713
|
.flex-wrap-reverse {
|
|
1714
1714
|
flex-wrap: wrap-reverse;
|
|
1715
1715
|
}
|
|
1716
|
+
.place-items-center {
|
|
1717
|
+
place-items: center;
|
|
1718
|
+
}
|
|
1716
1719
|
.items-baseline {
|
|
1717
1720
|
align-items: baseline;
|
|
1718
1721
|
}
|
|
@@ -5931,6 +5934,11 @@
|
|
|
5931
5934
|
grid-template-columns: 2fr 3fr 3fr;
|
|
5932
5935
|
}
|
|
5933
5936
|
}
|
|
5937
|
+
.rtl\:rotate-180 {
|
|
5938
|
+
&:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) {
|
|
5939
|
+
rotate: 180deg;
|
|
5940
|
+
}
|
|
5941
|
+
}
|
|
5934
5942
|
.rtl\:text-right {
|
|
5935
5943
|
&:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) {
|
|
5936
5944
|
text-align: right;
|