tfy-web-components 0.0.34 → 0.0.36
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/README.md +49 -58
- package/dist/Button-C77b7jpW.js +284 -0
- package/dist/Button-C77b7jpW.js.map +1 -0
- package/dist/CompositeItem-BGwD51jI.js +33 -0
- package/dist/CompositeItem-BGwD51jI.js.map +1 -0
- package/dist/CompositeList-D4xmSZ5V.js +291 -0
- package/dist/CompositeList-D4xmSZ5V.js.map +1 -0
- package/dist/CompositeRoot-BxrPc7F6.js +351 -0
- package/dist/CompositeRoot-BxrPc7F6.js.map +1 -0
- package/dist/DirectionContext-Pb9yafF5.js +11 -0
- package/dist/DirectionContext-Pb9yafF5.js.map +1 -0
- package/dist/FieldItemContext-DRVgx-D1.js +13 -0
- package/dist/FieldItemContext-DRVgx-D1.js.map +1 -0
- package/dist/{Input-BvwIpntS.js → Input-Dhmo6L2n.js} +100 -78
- package/dist/Input-Dhmo6L2n.js.map +1 -0
- package/dist/Modal-C4MUy9GD.js +696 -0
- package/dist/Modal-C4MUy9GD.js.map +1 -0
- package/dist/{MonacoEditorCore-xfpJ6z-E.js → MonacoEditorCore-n-df5f7I.js} +2 -2
- package/dist/{MonacoEditorCore-xfpJ6z-E.js.map → MonacoEditorCore-n-df5f7I.js.map} +1 -1
- package/dist/Popover-eC_vX5By.js +1074 -0
- package/dist/Popover-eC_vX5By.js.map +1 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js +11 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js.map +1 -0
- package/dist/Tooltip-BuGLP-PU.js +4096 -0
- package/dist/Tooltip-BuGLP-PU.js.map +1 -0
- package/dist/classNames-B1XpQHle.js +44 -0
- package/dist/classNames-B1XpQHle.js.map +1 -0
- package/dist/components/atoms/Accordion.d.ts +19 -37
- package/dist/components/atoms/Accordion.es.js +847 -78
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/AudioPlayer.es.js +9 -9
- package/dist/components/atoms/AudioPlayer.es.js.map +1 -1
- package/dist/components/atoms/Avatar.d.ts +42 -9
- package/dist/components/atoms/Avatar.es.js +491 -36
- package/dist/components/atoms/Avatar.es.js.map +1 -1
- package/dist/components/atoms/Badge.d.ts +40 -35
- package/dist/components/atoms/Badge.es.js +163 -53
- package/dist/components/atoms/Badge.es.js.map +1 -1
- package/dist/components/atoms/Button.d.ts +37 -16
- package/dist/components/atoms/Button.es.js +16 -221
- package/dist/components/atoms/Button.es.js.map +1 -1
- package/dist/components/atoms/ButtonGroup.d.ts +53 -0
- package/dist/components/atoms/ButtonGroup.es.js +349 -0
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -0
- package/dist/components/atoms/IconButton.d.ts +23 -9
- package/dist/components/atoms/IconButton.es.js +82 -16
- package/dist/components/atoms/IconButton.es.js.map +1 -1
- package/dist/components/atoms/IconProvider.d.ts +5 -2
- package/dist/components/atoms/IconProvider.es.js +69 -10
- package/dist/components/atoms/IconProvider.es.js.map +1 -1
- package/dist/components/atoms/Logo.d.ts +18 -0
- package/dist/components/atoms/Logo.es.js +79 -0
- package/dist/components/atoms/Logo.es.js.map +1 -0
- package/dist/components/atoms/Modal.d.ts +27 -3
- package/dist/components/atoms/Modal.es.js +15 -16
- package/dist/components/atoms/Modal.es.js.map +1 -1
- package/dist/components/atoms/Notification.d.ts +1 -1
- package/dist/components/atoms/Notification.es.js +26 -3
- package/dist/components/atoms/Notification.es.js.map +1 -1
- package/dist/components/atoms/OutlinedRadio.d.ts +6 -2
- package/dist/components/atoms/OutlinedRadio.es.js +12 -25
- package/dist/components/atoms/OutlinedRadio.es.js.map +1 -1
- package/dist/components/atoms/Progress.d.ts +48 -0
- package/dist/components/atoms/Progress.es.js +279 -0
- package/dist/components/atoms/Progress.es.js.map +1 -0
- package/dist/components/atoms/Skeleton.d.ts +9 -3
- package/dist/components/atoms/Skeleton.es.js +33 -3
- package/dist/components/atoms/Skeleton.es.js.map +1 -1
- package/dist/components/atoms/Spinner.d.ts +15 -4
- package/dist/components/atoms/Spinner.es.js +86 -22
- package/dist/components/atoms/Spinner.es.js.map +1 -1
- package/dist/components/atoms/Switch.d.ts +19 -7
- package/dist/components/atoms/Switch.es.js +288 -50
- package/dist/components/atoms/Switch.es.js.map +1 -1
- package/dist/components/atoms/TabButton.d.ts +17 -3
- package/dist/components/atoms/TabButton.es.js +647 -25
- package/dist/components/atoms/TabButton.es.js.map +1 -1
- package/dist/components/atoms/TabPanel.es.js +1 -1
- package/dist/components/atoms/Tag.d.ts +43 -0
- package/dist/components/atoms/Tag.es.js +219 -0
- package/dist/components/atoms/Tag.es.js.map +1 -0
- package/dist/components/atoms/Tooltip.d.ts +36 -14
- package/dist/components/atoms/Tooltip.es.js +7 -114
- package/dist/components/atoms/Tooltip.es.js.map +1 -1
- package/dist/components/molecules/Alert.d.ts +1 -1
- package/dist/components/molecules/Alert.es.js +13 -9
- package/dist/components/molecules/Alert.es.js.map +1 -1
- package/dist/components/molecules/CopyField.d.ts +2 -2
- package/dist/components/molecules/CopyField.es.js +3 -4
- package/dist/components/molecules/CopyField.es.js.map +1 -1
- package/dist/components/molecules/CustomDrawer.d.ts +5 -4
- package/dist/components/molecules/CustomDrawer.es.js +141 -82
- package/dist/components/molecules/CustomDrawer.es.js.map +1 -1
- package/dist/components/molecules/Dialog.d.ts +16 -8
- package/dist/components/molecules/Dialog.es.js +33 -31
- package/dist/components/molecules/Dialog.es.js.map +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +15 -11
- package/dist/components/molecules/ImagesPreview.es.js.map +1 -1
- package/dist/components/molecules/Input.d.ts +1 -1
- package/dist/components/molecules/Input.es.js +3 -5
- package/dist/components/molecules/Input.es.js.map +1 -1
- package/dist/components/molecules/Markdown/ExpandableMarkdown.d.ts +8 -8
- package/dist/components/molecules/Markdown/components.d.ts +12 -11
- package/dist/components/molecules/Markdown.es.js +26 -49
- package/dist/components/molecules/Markdown.es.js.map +1 -1
- package/dist/components/molecules/Notify.d.ts +30 -1
- package/dist/components/molecules/Notify.es.js +91 -36
- package/dist/components/molecules/Notify.es.js.map +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +32 -19
- package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -1
- package/dist/components/molecules/ToggleButton.d.ts +3 -2
- package/dist/components/molecules/ToggleButton.es.js +155 -57
- package/dist/components/molecules/ToggleButton.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessage.es.js +2 -2
- package/dist/components/molecules/agent-chat/UserMessage.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js +5 -5
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/index.d.ts +0 -6
- package/dist/components/molecules/agent-chat.es.js +76 -407
- package/dist/components/molecules/agent-chat.es.js.map +1 -1
- package/dist/components/molecules/monacoEditorCore/MonacoEditorCore.d.ts +0 -1
- package/dist/components/theme/colors.d.ts +17 -53
- package/dist/components/theme/colors.es.js +384 -180
- package/dist/components/theme/colors.es.js.map +1 -1
- package/dist/components/theme/theme.d.ts +14 -11
- package/dist/components/theme/theme.es.js +3 -64
- package/dist/components/theme/theme.es.js.map +1 -1
- package/dist/components/theme/useTheme.es.js +1 -4
- package/dist/components/theme/useTheme.es.js.map +1 -1
- package/dist/composite-CrCQWAKA.js +108 -0
- package/dist/composite-CrCQWAKA.js.map +1 -0
- package/dist/composite-DCpXNxz9.js +66 -0
- package/dist/composite-DCpXNxz9.js.map +1 -0
- package/dist/conversions-CbWPvHRE.js +14 -0
- package/dist/conversions-CbWPvHRE.js.map +1 -0
- package/dist/error-FX4R42W-.js +6 -0
- package/dist/error-FX4R42W-.js.map +1 -0
- package/dist/fonts.css +7 -0
- package/dist/hooks/useContainerDimensions.d.ts +1 -1
- package/dist/index-B806bfA-.js +257 -0
- package/dist/index-B806bfA-.js.map +1 -0
- package/dist/index-DSVg79g-.js +45 -0
- package/dist/index-DSVg79g-.js.map +1 -0
- package/dist/index.d.ts +21 -4
- package/dist/index.es.js +58 -9
- package/dist/index.es.js.map +1 -1
- package/dist/inertValue-IJM5NA30.js +11 -0
- package/dist/inertValue-IJM5NA30.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/markdown.css +13 -14
- package/dist/new-components/atoms/Checkbox.d.ts +6 -0
- package/dist/new-components/atoms/Checkbox.es.js +423 -0
- package/dist/new-components/atoms/Checkbox.es.js.map +1 -0
- package/dist/new-components/atoms/Chip.d.ts +38 -0
- package/dist/new-components/atoms/Chip.es.js +269 -0
- package/dist/new-components/atoms/Chip.es.js.map +1 -0
- package/dist/new-components/atoms/Popover.d.ts +87 -0
- package/dist/new-components/atoms/Popover.es.js +21 -0
- package/dist/new-components/atoms/Popover.es.js.map +1 -0
- package/dist/new-components/atoms/Radio.d.ts +14 -0
- package/dist/new-components/atoms/Radio.es.js +536 -0
- package/dist/new-components/atoms/Radio.es.js.map +1 -0
- package/dist/new-components/atoms/SegmentedControl.d.ts +28 -0
- package/dist/new-components/atoms/SegmentedControl.es.js +326 -0
- package/dist/new-components/atoms/SegmentedControl.es.js.map +1 -0
- package/dist/new-components/atoms/Slider.d.ts +8 -0
- package/dist/new-components/atoms/Slider.es.js +1415 -0
- package/dist/new-components/atoms/Slider.es.js.map +1 -0
- package/dist/new-components/atoms/Toggletip.d.ts +43 -0
- package/dist/new-components/atoms/Toggletip.es.js +216 -0
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -0
- package/dist/new-components/atoms/stories/ThemeComparison.d.ts +8 -0
- package/dist/shadowDom-Bq4g0Qeu.js +52 -0
- package/dist/shadowDom-Bq4g0Qeu.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/tfy-YZ5zY9Jw.js +6 -0
- package/dist/tfy-YZ5zY9Jw.js.map +1 -0
- package/dist/theme.css +9 -154
- package/dist/tokens.css +1124 -0
- package/dist/useAnimationFrame-DwhymJoW.js +108 -0
- package/dist/useAnimationFrame-DwhymJoW.js.map +1 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js +49 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js.map +1 -0
- package/dist/useBaseUiId-Ch7ujXpo.js +281 -0
- package/dist/useBaseUiId-Ch7ujXpo.js.map +1 -0
- package/dist/useButton-PUBhT4Vo.js +235 -0
- package/dist/useButton-PUBhT4Vo.js.map +1 -0
- package/dist/useControlled-BSyYkg5C.js +65 -0
- package/dist/useControlled-BSyYkg5C.js.map +1 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js +499 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js.map +1 -0
- package/dist/useLabelableId-DCLzrdD-.js +241 -0
- package/dist/useLabelableId-DCLzrdD-.js.map +1 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js +1086 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js.map +1 -0
- package/dist/usePopupHandleStore-BdS-xYID.js +2372 -0
- package/dist/usePopupHandleStore-BdS-xYID.js.map +1 -0
- package/dist/useTimeout-BXf1hDIL.js +46 -0
- package/dist/useTimeout-BXf1hDIL.js.map +1 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js +202 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js.map +1 -0
- package/dist/useValueAsRef-BfFRcMg6.js +28 -0
- package/dist/useValueAsRef-BfFRcMg6.js.map +1 -0
- package/dist/utils/classNames.d.ts +3 -2
- package/dist/visuallyHidden-B6H2X3_Y.js +26 -0
- package/dist/visuallyHidden-B6H2X3_Y.js.map +1 -0
- package/dist/vite-env.d.ts +18 -0
- package/package.json +30 -22
- package/dist/Input-BvwIpntS.js.map +0 -1
- package/dist/Notification-BT4CZ69U.js +0 -39
- package/dist/Notification-BT4CZ69U.js.map +0 -1
- package/dist/RootFontSizeContext-7vgn7Y_k.js +0 -22
- package/dist/RootFontSizeContext-7vgn7Y_k.js.map +0 -1
- package/dist/classNames-Dy-RXSjS.js +0 -9
- package/dist/classNames-Dy-RXSjS.js.map +0 -1
- package/dist/components/molecules/DropdownMenu.d.ts +0 -18
- package/dist/components/molecules/DropdownMenu.es.js +0 -104
- package/dist/components/molecules/DropdownMenu.es.js.map +0 -1
- package/dist/components/molecules/ThumbsFeedback.d.ts +0 -13
- package/dist/components/molecules/ThumbsFeedback.es.js +0 -98
- package/dist/components/molecules/ThumbsFeedback.es.js.map +0 -1
- package/dist/components/molecules/agent-chat/SandboxToolCall.d.ts +0 -15
- package/dist/components/molecules/agent-chat/ToolCallCard.d.ts +0 -26
- package/dist/components/molecules/agent-chat/ToolCallContentBlock.d.ts +0 -17
- package/dist/components/theme/lightColorPlugin.d.ts +0 -1
- package/dist/components/theme/lightColorPlugin.es.js +0 -92
- package/dist/components/theme/lightColorPlugin.es.js.map +0 -1
- package/dist/tailwindPreset.d.ts +0 -144
- package/dist/tailwindPreset.es.js +0 -100
- package/dist/tailwindPreset.es.js.map +0 -1
|
@@ -1,34 +1,656 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Tab from "@mui/material/Tab";
|
|
3
|
-
import Tooltip from "@mui/material/Tooltip";
|
|
4
|
-
import { c as classNames } from "../../classNames-Dy-RXSjS.js";
|
|
5
2
|
import IconProvider from "./IconProvider.es.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
import { D as DarkTooltip } from "../../Tooltip-BuGLP-PU.js";
|
|
4
|
+
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { u as useControlled } from "../../useControlled-BSyYkg5C.js";
|
|
7
|
+
import { f as formatErrorMessage, u as useIsoLayoutEffect, a as useStableCallback, b as useRenderElement, E as EMPTY_ARRAY } from "../../useIsoLayoutEffect-e9VA-ICd.js";
|
|
8
|
+
import { C as CompositeList, u as useCompositeListItem } from "../../CompositeList-D4xmSZ5V.js";
|
|
9
|
+
import { c as createChangeEventDetails, i as initial, m as missing, d as disabled, u as useBaseUiId, n as none } from "../../useBaseUiId-Ch7ujXpo.js";
|
|
10
|
+
import { i as inertValue } from "../../inertValue-IJM5NA30.js";
|
|
11
|
+
import { u as useTransitionStatus, a as useOpenChangeComplete, t as transitionStatusMapping } from "../../useTransitionStatus-C9gg_XJ-.js";
|
|
12
|
+
import { u as useCompositeItem, A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-BxrPc7F6.js";
|
|
13
|
+
import { o as ownerDocument } from "../../index-B806bfA-.js";
|
|
14
|
+
import { u as useCompositeRootContext, a as useButton } from "../../useButton-PUBhT4Vo.js";
|
|
15
|
+
import { c as contains, a as activeElement } from "../../shadowDom-Bq4g0Qeu.js";
|
|
16
|
+
const TabsRootContext = /* @__PURE__ */ React.createContext(void 0);
|
|
17
|
+
if (process.env.NODE_ENV !== "production") TabsRootContext.displayName = "TabsRootContext";
|
|
18
|
+
function useTabsRootContext() {
|
|
19
|
+
const context = React.useContext(TabsRootContext);
|
|
20
|
+
if (context === void 0) {
|
|
21
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : formatErrorMessage(64));
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
const activationDirection = "data-activation-direction";
|
|
26
|
+
const tabsStateAttributesMapping = {
|
|
27
|
+
tabActivationDirection: (dir) => ({
|
|
28
|
+
[activationDirection]: dir
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
const TabsRoot = /* @__PURE__ */ React.forwardRef(function TabsRoot2(componentProps, forwardedRef) {
|
|
32
|
+
const {
|
|
33
|
+
className,
|
|
34
|
+
defaultValue: defaultValueProp = 0,
|
|
35
|
+
onValueChange: onValueChangeProp,
|
|
36
|
+
orientation = "horizontal",
|
|
37
|
+
render,
|
|
38
|
+
value: valueProp,
|
|
39
|
+
style,
|
|
40
|
+
...elementProps
|
|
41
|
+
} = componentProps;
|
|
42
|
+
const hasExplicitDefaultValueProp = componentProps.defaultValue !== void 0;
|
|
43
|
+
const tabPanelRefs = React.useRef([]);
|
|
44
|
+
const [mountedTabPanels, setMountedTabPanels] = React.useState(() => /* @__PURE__ */ new Map());
|
|
45
|
+
const [value, setValue] = useControlled({
|
|
46
|
+
controlled: valueProp,
|
|
47
|
+
default: defaultValueProp,
|
|
48
|
+
name: "Tabs",
|
|
49
|
+
state: "value"
|
|
50
|
+
});
|
|
51
|
+
const isControlled = valueProp !== void 0;
|
|
52
|
+
const [tabMap, setTabMap] = React.useState(() => /* @__PURE__ */ new Map());
|
|
53
|
+
const lastKnownTabElementRef = React.useRef(void 0);
|
|
54
|
+
const getTabElementBySelectedValue = React.useCallback((selectedValue) => findTabElement(tabMap, selectedValue), [tabMap]);
|
|
55
|
+
const [activationDirectionState, setActivationDirectionState] = React.useState(() => ({
|
|
56
|
+
previousValue: value,
|
|
57
|
+
tabActivationDirection: "none"
|
|
58
|
+
}));
|
|
59
|
+
const {
|
|
60
|
+
previousValue,
|
|
61
|
+
tabActivationDirection: committedTabActivationDirection
|
|
62
|
+
} = activationDirectionState;
|
|
63
|
+
let tabActivationDirection = committedTabActivationDirection;
|
|
64
|
+
let directionComputationIncomplete = false;
|
|
65
|
+
if (previousValue !== value) {
|
|
66
|
+
tabActivationDirection = computeActivationDirection(previousValue, value, orientation, tabMap);
|
|
67
|
+
directionComputationIncomplete = previousValue != null && value != null && getTabElementBySelectedValue(value) == null;
|
|
68
|
+
}
|
|
69
|
+
const nextPreviousValue = directionComputationIncomplete ? previousValue : value;
|
|
70
|
+
const shouldSyncActivationDirectionState = previousValue !== nextPreviousValue || committedTabActivationDirection !== tabActivationDirection;
|
|
71
|
+
useIsoLayoutEffect(() => {
|
|
72
|
+
if (!shouldSyncActivationDirectionState) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
setActivationDirectionState({
|
|
76
|
+
previousValue: nextPreviousValue,
|
|
77
|
+
tabActivationDirection
|
|
78
|
+
});
|
|
79
|
+
}, [nextPreviousValue, shouldSyncActivationDirectionState, tabActivationDirection]);
|
|
80
|
+
const onValueChange = useStableCallback((newValue, eventDetails) => {
|
|
81
|
+
const activationDirection2 = computeActivationDirection(value, newValue, orientation, tabMap);
|
|
82
|
+
eventDetails.activationDirection = activationDirection2;
|
|
83
|
+
onValueChangeProp == null ? void 0 : onValueChangeProp(newValue, eventDetails);
|
|
84
|
+
if (eventDetails.isCanceled) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
setValue(() => newValue);
|
|
88
|
+
});
|
|
89
|
+
const notifyAutomaticValueChange = useStableCallback((nextValue, reason) => {
|
|
90
|
+
onValueChangeProp == null ? void 0 : onValueChangeProp(nextValue, createChangeEventDetails(reason, void 0, void 0, {
|
|
91
|
+
activationDirection: "none"
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
const registerMountedTabPanel = useStableCallback((panelValue, panelId) => {
|
|
95
|
+
setMountedTabPanels((prev) => {
|
|
96
|
+
const next = new Map(prev);
|
|
97
|
+
next.set(panelValue, panelId);
|
|
98
|
+
return next;
|
|
99
|
+
});
|
|
100
|
+
return () => {
|
|
101
|
+
setMountedTabPanels((prev) => {
|
|
102
|
+
if (prev.get(panelValue) !== panelId) {
|
|
103
|
+
return prev;
|
|
24
104
|
}
|
|
105
|
+
const next = new Map(prev);
|
|
106
|
+
next.delete(panelValue);
|
|
107
|
+
return next;
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
const getTabPanelIdByValue = React.useCallback((tabValue) => {
|
|
112
|
+
return mountedTabPanels.get(tabValue);
|
|
113
|
+
}, [mountedTabPanels]);
|
|
114
|
+
const getTabIdByPanelValue = React.useCallback((tabPanelValue) => {
|
|
115
|
+
for (const tabMetadata of tabMap.values()) {
|
|
116
|
+
if (tabPanelValue === tabMetadata.value) {
|
|
117
|
+
return tabMetadata.id;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return void 0;
|
|
121
|
+
}, [tabMap]);
|
|
122
|
+
const tabsContextValue = React.useMemo(() => ({
|
|
123
|
+
getTabElementBySelectedValue,
|
|
124
|
+
getTabIdByPanelValue,
|
|
125
|
+
getTabPanelIdByValue,
|
|
126
|
+
onValueChange,
|
|
127
|
+
orientation,
|
|
128
|
+
registerMountedTabPanel,
|
|
129
|
+
setTabMap,
|
|
130
|
+
tabActivationDirection,
|
|
131
|
+
value
|
|
132
|
+
}), [getTabElementBySelectedValue, getTabIdByPanelValue, getTabPanelIdByValue, onValueChange, orientation, registerMountedTabPanel, setTabMap, tabActivationDirection, value]);
|
|
133
|
+
const selectedTabMetadata = React.useMemo(() => {
|
|
134
|
+
for (const tabMetadata of tabMap.values()) {
|
|
135
|
+
if (tabMetadata.value === value) {
|
|
136
|
+
return tabMetadata;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return void 0;
|
|
140
|
+
}, [tabMap, value]);
|
|
141
|
+
const firstEnabledTabValue = React.useMemo(() => {
|
|
142
|
+
for (const tabMetadata of tabMap.values()) {
|
|
143
|
+
if (!tabMetadata.disabled) {
|
|
144
|
+
return tabMetadata.value;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return void 0;
|
|
148
|
+
}, [tabMap]);
|
|
149
|
+
const shouldNotifyInitialValueChangeRef = React.useRef(!hasExplicitDefaultValueProp);
|
|
150
|
+
const initialDefaultValueRef = React.useRef(defaultValueProp);
|
|
151
|
+
const shouldHonorDisabledDefaultValueRef = React.useRef(hasExplicitDefaultValueProp);
|
|
152
|
+
const didRegisterTabsRef = React.useRef(false);
|
|
153
|
+
useIsoLayoutEffect(() => {
|
|
154
|
+
var _a;
|
|
155
|
+
if (isControlled) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
function commitAutomaticValueChange(fallbackValue, fallbackReason) {
|
|
159
|
+
setValue(() => fallbackValue);
|
|
160
|
+
setActivationDirectionState({
|
|
161
|
+
previousValue: fallbackValue,
|
|
162
|
+
tabActivationDirection: "none"
|
|
163
|
+
});
|
|
164
|
+
notifyAutomaticValueChange(fallbackValue, fallbackReason);
|
|
165
|
+
shouldNotifyInitialValueChangeRef.current = false;
|
|
166
|
+
}
|
|
167
|
+
if (tabMap.size === 0) {
|
|
168
|
+
if (didRegisterTabsRef.current && value !== null && !((_a = lastKnownTabElementRef.current) == null ? void 0 : _a.isConnected)) {
|
|
169
|
+
commitAutomaticValueChange(null, missing);
|
|
170
|
+
}
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
didRegisterTabsRef.current = true;
|
|
174
|
+
lastKnownTabElementRef.current = tabMap.keys().next().value;
|
|
175
|
+
const selectionIsDisabled = selectedTabMetadata == null ? void 0 : selectedTabMetadata.disabled;
|
|
176
|
+
const selectionIsMissing = selectedTabMetadata == null && value !== null;
|
|
177
|
+
if (!selectionIsDisabled && value === initialDefaultValueRef.current) {
|
|
178
|
+
shouldHonorDisabledDefaultValueRef.current = false;
|
|
179
|
+
}
|
|
180
|
+
if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
|
|
184
|
+
if (selectionIsDisabled || selectionIsMissing) {
|
|
185
|
+
const fallbackValue = firstEnabledTabValue ?? null;
|
|
186
|
+
if (value === fallbackValue) {
|
|
187
|
+
shouldNotifyInitialValueChangeRef.current = false;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
let fallbackReason = missing;
|
|
191
|
+
if (shouldNotifyInitialValueChange) {
|
|
192
|
+
fallbackReason = initial;
|
|
193
|
+
} else if (selectionIsDisabled) {
|
|
194
|
+
fallbackReason = disabled;
|
|
195
|
+
}
|
|
196
|
+
commitAutomaticValueChange(fallbackValue, fallbackReason);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (shouldNotifyInitialValueChange && selectedTabMetadata != null) {
|
|
200
|
+
notifyAutomaticValueChange(value, initial);
|
|
201
|
+
shouldNotifyInitialValueChangeRef.current = false;
|
|
202
|
+
}
|
|
203
|
+
}, [firstEnabledTabValue, isControlled, notifyAutomaticValueChange, selectedTabMetadata, setValue, tabMap, value]);
|
|
204
|
+
const state = {
|
|
205
|
+
orientation,
|
|
206
|
+
tabActivationDirection
|
|
207
|
+
};
|
|
208
|
+
const element = useRenderElement("div", componentProps, {
|
|
209
|
+
state,
|
|
210
|
+
ref: forwardedRef,
|
|
211
|
+
props: elementProps,
|
|
212
|
+
stateAttributesMapping: tabsStateAttributesMapping
|
|
213
|
+
});
|
|
214
|
+
return /* @__PURE__ */ jsx(TabsRootContext.Provider, {
|
|
215
|
+
value: tabsContextValue,
|
|
216
|
+
children: /* @__PURE__ */ jsx(CompositeList, {
|
|
217
|
+
elementsRef: tabPanelRefs,
|
|
218
|
+
children: element
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
if (process.env.NODE_ENV !== "production") TabsRoot.displayName = "TabsRoot";
|
|
223
|
+
function findTabElement(tabMap, value) {
|
|
224
|
+
for (const [tabElement, tabMetadata] of tabMap.entries()) {
|
|
225
|
+
if (value === tabMetadata.value) {
|
|
226
|
+
return tabElement;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
|
|
232
|
+
if (oldValue == null || newValue == null) {
|
|
233
|
+
return "none";
|
|
234
|
+
}
|
|
235
|
+
const [positionProp, backward, forward] = orientation === "horizontal" ? ["left", "left", "right"] : ["top", "up", "down"];
|
|
236
|
+
const oldTab = findTabElement(tabMap, oldValue);
|
|
237
|
+
const newTab = findTabElement(tabMap, newValue);
|
|
238
|
+
if (oldTab == null || newTab == null) {
|
|
239
|
+
if (oldTab !== newTab && (typeof oldValue === "number" || typeof oldValue === "string") && typeof oldValue === typeof newValue) {
|
|
240
|
+
return newValue > oldValue ? forward : backward;
|
|
241
|
+
}
|
|
242
|
+
return "none";
|
|
243
|
+
}
|
|
244
|
+
const oldPosition = oldTab.getBoundingClientRect()[positionProp];
|
|
245
|
+
const newPosition = newTab.getBoundingClientRect()[positionProp];
|
|
246
|
+
if (newPosition < oldPosition) {
|
|
247
|
+
return backward;
|
|
248
|
+
}
|
|
249
|
+
if (newPosition > oldPosition) {
|
|
250
|
+
return forward;
|
|
251
|
+
}
|
|
252
|
+
return "none";
|
|
253
|
+
}
|
|
254
|
+
const TabsListContext = /* @__PURE__ */ React.createContext(void 0);
|
|
255
|
+
if (process.env.NODE_ENV !== "production") TabsListContext.displayName = "TabsListContext";
|
|
256
|
+
function useTabsListContext() {
|
|
257
|
+
const context = React.useContext(TabsListContext);
|
|
258
|
+
if (context === void 0) {
|
|
259
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage(65));
|
|
260
|
+
}
|
|
261
|
+
return context;
|
|
262
|
+
}
|
|
263
|
+
const TabsTab = /* @__PURE__ */ React.forwardRef(function TabsTab2(componentProps, forwardedRef) {
|
|
264
|
+
const {
|
|
265
|
+
className,
|
|
266
|
+
disabled: disabled2 = false,
|
|
267
|
+
render,
|
|
268
|
+
value,
|
|
269
|
+
id: idProp,
|
|
270
|
+
nativeButton = true,
|
|
271
|
+
style,
|
|
272
|
+
...elementProps
|
|
273
|
+
} = componentProps;
|
|
274
|
+
const {
|
|
275
|
+
value: activeTabValue,
|
|
276
|
+
getTabPanelIdByValue,
|
|
277
|
+
onValueChange,
|
|
278
|
+
orientation,
|
|
279
|
+
tabActivationDirection
|
|
280
|
+
} = useTabsRootContext();
|
|
281
|
+
const {
|
|
282
|
+
activateOnFocus,
|
|
283
|
+
registerTabResizeObserverElement,
|
|
284
|
+
tabsListElement
|
|
285
|
+
} = useTabsListContext();
|
|
286
|
+
const {
|
|
287
|
+
highlightedIndex,
|
|
288
|
+
onHighlightedIndexChange
|
|
289
|
+
} = useCompositeRootContext();
|
|
290
|
+
const id = useBaseUiId(idProp);
|
|
291
|
+
const tabMetadata = React.useMemo(() => ({
|
|
292
|
+
disabled: disabled2,
|
|
293
|
+
id,
|
|
294
|
+
value
|
|
295
|
+
}), [disabled2, id, value]);
|
|
296
|
+
const {
|
|
297
|
+
compositeProps,
|
|
298
|
+
compositeRef,
|
|
299
|
+
index: index2
|
|
300
|
+
// hook is used instead of the CompositeItem component
|
|
301
|
+
// because the index is needed for Tab internals
|
|
302
|
+
} = useCompositeItem({
|
|
303
|
+
metadata: tabMetadata
|
|
304
|
+
});
|
|
305
|
+
const active = value === activeTabValue;
|
|
306
|
+
const isNavigatingRef = React.useRef(false);
|
|
307
|
+
const unobserveTabElementRef = React.useRef(null);
|
|
308
|
+
const observeTabElement = useStableCallback((element2) => {
|
|
309
|
+
var _a;
|
|
310
|
+
(_a = unobserveTabElementRef.current) == null ? void 0 : _a.call(unobserveTabElementRef);
|
|
311
|
+
unobserveTabElementRef.current = element2 ? registerTabResizeObserverElement(element2) : null;
|
|
312
|
+
});
|
|
313
|
+
useIsoLayoutEffect(() => {
|
|
314
|
+
if (isNavigatingRef.current) {
|
|
315
|
+
isNavigatingRef.current = false;
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (!(active && index2 > -1 && highlightedIndex !== index2)) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const listElement = tabsListElement;
|
|
322
|
+
if (listElement != null) {
|
|
323
|
+
const activeEl = activeElement(ownerDocument(listElement));
|
|
324
|
+
if (activeEl && contains(listElement, activeEl)) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (!disabled2) {
|
|
329
|
+
onHighlightedIndexChange(index2);
|
|
330
|
+
}
|
|
331
|
+
}, [active, index2, highlightedIndex, onHighlightedIndexChange, disabled2, tabsListElement]);
|
|
332
|
+
const {
|
|
333
|
+
getButtonProps,
|
|
334
|
+
buttonRef
|
|
335
|
+
} = useButton({
|
|
336
|
+
disabled: disabled2,
|
|
337
|
+
native: nativeButton,
|
|
338
|
+
focusableWhenDisabled: true
|
|
339
|
+
});
|
|
340
|
+
const tabPanelId = getTabPanelIdByValue(value);
|
|
341
|
+
const isPressingRef = React.useRef(false);
|
|
342
|
+
const isMainButtonRef = React.useRef(false);
|
|
343
|
+
function activate(event) {
|
|
344
|
+
onValueChange(value, createChangeEventDetails(none, event.nativeEvent, void 0, {
|
|
345
|
+
activationDirection: "none"
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
function onClick(event) {
|
|
349
|
+
if (active || disabled2) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
activate(event);
|
|
353
|
+
}
|
|
354
|
+
function onFocus(event) {
|
|
355
|
+
if (active || disabled2) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (activateOnFocus && (!isPressingRef.current || // keyboard or touch focus
|
|
359
|
+
isMainButtonRef.current)) {
|
|
360
|
+
activate(event);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function onPointerDown(event) {
|
|
364
|
+
if (active || disabled2) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
isPressingRef.current = true;
|
|
368
|
+
isMainButtonRef.current = event.button === 0;
|
|
369
|
+
const doc = ownerDocument(event.currentTarget);
|
|
370
|
+
function handlePointerEnd() {
|
|
371
|
+
isPressingRef.current = false;
|
|
372
|
+
isMainButtonRef.current = false;
|
|
373
|
+
doc.removeEventListener("pointerup", handlePointerEnd);
|
|
374
|
+
doc.removeEventListener("pointercancel", handlePointerEnd);
|
|
375
|
+
}
|
|
376
|
+
doc.addEventListener("pointerup", handlePointerEnd);
|
|
377
|
+
doc.addEventListener("pointercancel", handlePointerEnd);
|
|
378
|
+
}
|
|
379
|
+
const state = {
|
|
380
|
+
disabled: disabled2,
|
|
381
|
+
active,
|
|
382
|
+
orientation,
|
|
383
|
+
tabActivationDirection
|
|
384
|
+
};
|
|
385
|
+
const element = useRenderElement("button", componentProps, {
|
|
386
|
+
state,
|
|
387
|
+
ref: [forwardedRef, buttonRef, compositeRef, observeTabElement],
|
|
388
|
+
props: [compositeProps, {
|
|
389
|
+
role: "tab",
|
|
390
|
+
"aria-controls": tabPanelId,
|
|
391
|
+
"aria-selected": active,
|
|
392
|
+
id,
|
|
393
|
+
onClick,
|
|
394
|
+
onFocus,
|
|
395
|
+
onPointerDown,
|
|
396
|
+
[ACTIVE_COMPOSITE_ITEM]: active ? "" : void 0,
|
|
397
|
+
onKeyDownCapture() {
|
|
398
|
+
isNavigatingRef.current = true;
|
|
399
|
+
}
|
|
400
|
+
}, elementProps, getButtonProps],
|
|
401
|
+
stateAttributesMapping: tabsStateAttributesMapping
|
|
402
|
+
});
|
|
403
|
+
return element;
|
|
404
|
+
});
|
|
405
|
+
if (process.env.NODE_ENV !== "production") TabsTab.displayName = "TabsTab";
|
|
406
|
+
const index = "data-index";
|
|
407
|
+
const stateAttributesMapping = {
|
|
408
|
+
...tabsStateAttributesMapping,
|
|
409
|
+
...transitionStatusMapping
|
|
410
|
+
};
|
|
411
|
+
const TabsPanel = /* @__PURE__ */ React.forwardRef(function TabsPanel2(componentProps, forwardedRef) {
|
|
412
|
+
const {
|
|
413
|
+
className,
|
|
414
|
+
value,
|
|
415
|
+
render,
|
|
416
|
+
keepMounted = false,
|
|
417
|
+
style,
|
|
418
|
+
...elementProps
|
|
419
|
+
} = componentProps;
|
|
420
|
+
const {
|
|
421
|
+
value: selectedValue,
|
|
422
|
+
getTabIdByPanelValue,
|
|
423
|
+
orientation,
|
|
424
|
+
tabActivationDirection,
|
|
425
|
+
registerMountedTabPanel
|
|
426
|
+
} = useTabsRootContext();
|
|
427
|
+
const id = useBaseUiId();
|
|
428
|
+
const {
|
|
429
|
+
ref: listItemRef,
|
|
430
|
+
index: index$1
|
|
431
|
+
} = useCompositeListItem();
|
|
432
|
+
const open = value === selectedValue;
|
|
433
|
+
const {
|
|
434
|
+
mounted,
|
|
435
|
+
transitionStatus,
|
|
436
|
+
setMounted
|
|
437
|
+
} = useTransitionStatus(open);
|
|
438
|
+
const hidden = !mounted;
|
|
439
|
+
const correspondingTabId = getTabIdByPanelValue(value);
|
|
440
|
+
const state = {
|
|
441
|
+
hidden,
|
|
442
|
+
orientation,
|
|
443
|
+
tabActivationDirection,
|
|
444
|
+
transitionStatus
|
|
445
|
+
};
|
|
446
|
+
const panelRef = React.useRef(null);
|
|
447
|
+
const element = useRenderElement("div", componentProps, {
|
|
448
|
+
state,
|
|
449
|
+
ref: [forwardedRef, listItemRef, panelRef],
|
|
450
|
+
props: [{
|
|
451
|
+
"aria-labelledby": correspondingTabId,
|
|
452
|
+
hidden,
|
|
453
|
+
id,
|
|
454
|
+
role: "tabpanel",
|
|
455
|
+
tabIndex: open ? 0 : -1,
|
|
456
|
+
inert: inertValue(!open),
|
|
457
|
+
// Computed key: a plain literal key fails the DOM-props excess property check.
|
|
458
|
+
[index]: index$1
|
|
459
|
+
}, elementProps],
|
|
460
|
+
stateAttributesMapping
|
|
461
|
+
});
|
|
462
|
+
useOpenChangeComplete({
|
|
463
|
+
open,
|
|
464
|
+
ref: panelRef,
|
|
465
|
+
onComplete() {
|
|
466
|
+
if (!open) {
|
|
467
|
+
setMounted(false);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
useIsoLayoutEffect(() => {
|
|
472
|
+
if (id == null || hidden && !keepMounted) {
|
|
473
|
+
return void 0;
|
|
474
|
+
}
|
|
475
|
+
return registerMountedTabPanel(value, id);
|
|
476
|
+
}, [hidden, keepMounted, value, id, registerMountedTabPanel]);
|
|
477
|
+
const shouldRender = keepMounted || mounted;
|
|
478
|
+
if (!shouldRender) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
return element;
|
|
482
|
+
});
|
|
483
|
+
if (process.env.NODE_ENV !== "production") TabsPanel.displayName = "TabsPanel";
|
|
484
|
+
const TabsList$1 = /* @__PURE__ */ React.forwardRef(function TabsList(componentProps, forwardedRef) {
|
|
485
|
+
const {
|
|
486
|
+
activateOnFocus = false,
|
|
487
|
+
className,
|
|
488
|
+
loopFocus = true,
|
|
489
|
+
render,
|
|
490
|
+
style,
|
|
491
|
+
...elementProps
|
|
492
|
+
} = componentProps;
|
|
493
|
+
const {
|
|
494
|
+
orientation,
|
|
495
|
+
setTabMap,
|
|
496
|
+
tabActivationDirection
|
|
497
|
+
} = useTabsRootContext();
|
|
498
|
+
const [highlightedTabIndex, setHighlightedTabIndex] = React.useState(0);
|
|
499
|
+
const [tabsListElement, setTabsListElement] = React.useState(null);
|
|
500
|
+
const indicatorUpdateListenersRef = React.useRef(/* @__PURE__ */ new Set());
|
|
501
|
+
const tabResizeObserverElementsRef = React.useRef(/* @__PURE__ */ new Set());
|
|
502
|
+
const resizeObserverRef = React.useRef(null);
|
|
503
|
+
useIsoLayoutEffect(() => {
|
|
504
|
+
if (typeof ResizeObserver === "undefined") {
|
|
505
|
+
return void 0;
|
|
506
|
+
}
|
|
507
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
508
|
+
indicatorUpdateListenersRef.current.forEach((listener) => {
|
|
509
|
+
listener();
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
resizeObserverRef.current = resizeObserver;
|
|
513
|
+
if (tabsListElement) {
|
|
514
|
+
resizeObserver.observe(tabsListElement);
|
|
515
|
+
}
|
|
516
|
+
tabResizeObserverElementsRef.current.forEach((element) => {
|
|
517
|
+
resizeObserver.observe(element);
|
|
518
|
+
});
|
|
519
|
+
return () => {
|
|
520
|
+
resizeObserver.disconnect();
|
|
521
|
+
resizeObserverRef.current = null;
|
|
522
|
+
};
|
|
523
|
+
}, [tabsListElement]);
|
|
524
|
+
const registerIndicatorUpdateListener = useStableCallback((listener) => {
|
|
525
|
+
indicatorUpdateListenersRef.current.add(listener);
|
|
526
|
+
return () => {
|
|
527
|
+
indicatorUpdateListenersRef.current.delete(listener);
|
|
528
|
+
};
|
|
529
|
+
});
|
|
530
|
+
const registerTabResizeObserverElement = useStableCallback((element) => {
|
|
531
|
+
var _a;
|
|
532
|
+
tabResizeObserverElementsRef.current.add(element);
|
|
533
|
+
(_a = resizeObserverRef.current) == null ? void 0 : _a.observe(element);
|
|
534
|
+
return () => {
|
|
535
|
+
var _a2;
|
|
536
|
+
tabResizeObserverElementsRef.current.delete(element);
|
|
537
|
+
(_a2 = resizeObserverRef.current) == null ? void 0 : _a2.unobserve(element);
|
|
538
|
+
};
|
|
539
|
+
});
|
|
540
|
+
const state = {
|
|
541
|
+
orientation,
|
|
542
|
+
tabActivationDirection
|
|
543
|
+
};
|
|
544
|
+
const defaultProps = {
|
|
545
|
+
"aria-orientation": orientation === "vertical" ? "vertical" : void 0,
|
|
546
|
+
role: "tablist"
|
|
547
|
+
};
|
|
548
|
+
const tabsListContextValue = React.useMemo(() => ({
|
|
549
|
+
activateOnFocus,
|
|
550
|
+
registerIndicatorUpdateListener,
|
|
551
|
+
registerTabResizeObserverElement,
|
|
552
|
+
tabsListElement
|
|
553
|
+
}), [activateOnFocus, registerIndicatorUpdateListener, registerTabResizeObserverElement, tabsListElement]);
|
|
554
|
+
return /* @__PURE__ */ jsx(TabsListContext.Provider, {
|
|
555
|
+
value: tabsListContextValue,
|
|
556
|
+
children: /* @__PURE__ */ jsx(CompositeRoot, {
|
|
557
|
+
render,
|
|
558
|
+
className,
|
|
559
|
+
style,
|
|
560
|
+
state,
|
|
561
|
+
refs: [forwardedRef, setTabsListElement],
|
|
562
|
+
props: [defaultProps, elementProps],
|
|
563
|
+
stateAttributesMapping: tabsStateAttributesMapping,
|
|
564
|
+
highlightedIndex: highlightedTabIndex,
|
|
565
|
+
enableHomeAndEndKeys: true,
|
|
566
|
+
loopFocus,
|
|
567
|
+
orientation,
|
|
568
|
+
onHighlightedIndexChange: setHighlightedTabIndex,
|
|
569
|
+
onMapChange: setTabMap,
|
|
570
|
+
disabledIndices: EMPTY_ARRAY
|
|
571
|
+
})
|
|
572
|
+
});
|
|
573
|
+
});
|
|
574
|
+
if (process.env.NODE_ENV !== "production") TabsList$1.displayName = "TabsList";
|
|
575
|
+
function Tabs(props) {
|
|
576
|
+
return /* @__PURE__ */ jsx(TabsRoot, { "data-slot": "tabs", ...props });
|
|
577
|
+
}
|
|
578
|
+
function TabsList2({ className, ...props }) {
|
|
579
|
+
return /* @__PURE__ */ jsx(
|
|
580
|
+
TabsList$1,
|
|
581
|
+
{
|
|
582
|
+
"data-slot": "tabs-list",
|
|
583
|
+
className: classNames("inline-flex h-9 items-center gap-1 rounded-md bg-tabs-contained-background-rest p-1", className),
|
|
584
|
+
...props
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
function TabsTrigger({ className, ...props }) {
|
|
589
|
+
return /* @__PURE__ */ jsx(
|
|
590
|
+
TabsTab,
|
|
591
|
+
{
|
|
592
|
+
"data-slot": "tabs-trigger",
|
|
593
|
+
className: classNames(
|
|
594
|
+
"inline-flex items-center justify-center rounded-sm px-3 py-1 text-label-sm text-text-secondary transition-colors hover:bg-tabs-background-hover focus-ring disabled:pointer-events-none disabled:opacity-50 data-active:bg-tabs-contained-background-selected data-active:text-tabs-text-selected",
|
|
595
|
+
className
|
|
25
596
|
),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
597
|
+
...props
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
function TabsContent({ className, ...props }) {
|
|
602
|
+
return /* @__PURE__ */ jsx(
|
|
603
|
+
TabsPanel,
|
|
604
|
+
{
|
|
605
|
+
"data-slot": "tabs-content",
|
|
606
|
+
className: classNames("mt-12 focus-ring outline-none", className),
|
|
607
|
+
...props
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
const TabButton = ({
|
|
612
|
+
id,
|
|
613
|
+
icon,
|
|
614
|
+
text,
|
|
615
|
+
tooltip,
|
|
616
|
+
textClassName,
|
|
617
|
+
iconSize,
|
|
618
|
+
isActive,
|
|
619
|
+
value,
|
|
620
|
+
disabled: disabled2,
|
|
621
|
+
className,
|
|
622
|
+
...props
|
|
623
|
+
}) => {
|
|
624
|
+
const trigger = /* @__PURE__ */ jsx(
|
|
625
|
+
TabsTrigger,
|
|
626
|
+
{
|
|
627
|
+
value: value ?? id,
|
|
628
|
+
disabled: disabled2,
|
|
629
|
+
className: classNames("max-w-[22.5rem] min-w-[5.625rem] px-4 py-3 capitalize", className),
|
|
630
|
+
...props,
|
|
631
|
+
children: /* @__PURE__ */ jsxs("span", { className: classNames("flex items-center gap-2", disabled2 && "opacity-50"), children: [
|
|
632
|
+
icon && /* @__PURE__ */ jsx(
|
|
633
|
+
IconProvider,
|
|
634
|
+
{
|
|
635
|
+
icon,
|
|
636
|
+
className: classNames("fill-icon-brand text-icon-brand", isActive && "text-icon-brand"),
|
|
637
|
+
size: iconSize || 1
|
|
638
|
+
}
|
|
639
|
+
),
|
|
640
|
+
/* @__PURE__ */ jsx("span", { className: classNames("text-base font-lab", textClassName), children: text })
|
|
641
|
+
] })
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
if (!tooltip) {
|
|
645
|
+
return trigger;
|
|
29
646
|
}
|
|
30
|
-
);
|
|
647
|
+
return /* @__PURE__ */ jsx(DarkTooltip, { title: tooltip, placement: "bottom", children: trigger });
|
|
648
|
+
};
|
|
31
649
|
export {
|
|
650
|
+
Tabs,
|
|
651
|
+
TabsContent,
|
|
652
|
+
TabsList2 as TabsList,
|
|
653
|
+
TabsTrigger,
|
|
32
654
|
TabButton as default
|
|
33
655
|
};
|
|
34
656
|
//# sourceMappingURL=TabButton.es.js.map
|