@yahoo/uds 3.126.0 → 3.127.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/generated/autoVariants.cjs +25 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +7 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +7 -0
- package/dist/automated-config/dist/generated/autoVariants.js +25 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +3181 -0
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +305 -1
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +305 -1
- package/dist/automated-config/dist/generated/generatedConfigs.js +3180 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +754 -0
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +3 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +3 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +754 -0
- package/dist/automated-config/dist/properties.cjs +12 -0
- package/dist/automated-config/dist/properties.d.cts +4 -0
- package/dist/automated-config/dist/properties.d.ts +4 -0
- package/dist/automated-config/dist/properties.js +12 -0
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/automated-config/dist/utils/index.cjs +103 -6
- package/dist/automated-config/dist/utils/index.js +103 -6
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
- package/dist/components/client/Tabs/Tab.cjs +80 -0
- package/dist/components/client/Tabs/Tab.d.cts +20 -0
- package/dist/components/client/Tabs/Tab.d.ts +21 -0
- package/dist/components/client/Tabs/Tab.js +78 -0
- package/dist/components/client/Tabs/TabList.cjs +132 -0
- package/dist/components/client/Tabs/TabList.d.cts +9 -0
- package/dist/components/client/Tabs/TabList.d.ts +10 -0
- package/dist/components/client/Tabs/TabList.js +130 -0
- package/dist/components/client/Tabs/TabPanel.cjs +22 -0
- package/dist/components/client/Tabs/TabPanel.d.cts +9 -0
- package/dist/components/client/Tabs/TabPanel.d.ts +10 -0
- package/dist/components/client/Tabs/TabPanel.js +20 -0
- package/dist/components/client/Tabs/Tabs.cjs +53 -0
- package/dist/components/client/Tabs/Tabs.d.cts +45 -0
- package/dist/components/client/Tabs/Tabs.d.ts +46 -0
- package/dist/components/client/Tabs/Tabs.js +51 -0
- package/dist/components/client/Tabs/index.cjs +12 -0
- package/dist/components/client/Tabs/index.d.cts +7 -0
- package/dist/components/client/Tabs/index.d.ts +8 -0
- package/dist/components/client/Tabs/index.js +8 -0
- package/dist/components/client/Tabs/tabsContext.cjs +18 -0
- package/dist/components/client/Tabs/tabsContext.d.cts +15 -0
- package/dist/components/client/Tabs/tabsContext.d.ts +16 -0
- package/dist/components/client/Tabs/tabsContext.js +15 -0
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +5 -5
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +5 -5
- package/dist/components/client/index.cjs +8 -0
- package/dist/components/client/index.d.cts +7 -1
- package/dist/components/client/index.d.ts +7 -1
- package/dist/components/client/index.js +5 -1
- package/dist/components/experimental/client/index.cjs +0 -5
- package/dist/components/experimental/client/index.d.cts +1 -2
- package/dist/components/experimental/client/index.d.ts +1 -2
- package/dist/components/experimental/client/index.js +1 -2
- package/dist/components/experimental/index.cjs +0 -9
- package/dist/components/experimental/index.d.cts +1 -2
- package/dist/components/experimental/index.d.ts +1 -2
- package/dist/components/experimental/index.js +1 -6
- package/dist/components/index.cjs +12 -0
- package/dist/components/index.d.cts +6 -1
- package/dist/components/index.d.ts +6 -1
- package/dist/components/index.js +9 -1
- package/dist/config/dist/index.cjs +824 -2
- package/dist/config/dist/index.js +824 -2
- package/dist/index.cjs +10 -0
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +6 -2
- package/dist/styles/styler.d.cts +97 -90
- package/dist/styles/styler.d.ts +97 -90
- package/dist/styles/variants.d.cts +29 -0
- package/dist/styles/variants.d.ts +29 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.cjs +25 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js +25 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.cjs +3181 -0
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js +3180 -1
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/properties.cjs +12 -0
- package/dist/tailwind/dist/automated-config/dist/properties.js +12 -0
- package/dist/tailwind/dist/automated-config/dist/properties.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/index.cjs +103 -6
- package/dist/tailwind/dist/automated-config/dist/utils/index.js +103 -6
- package/dist/tailwind/dist/automated-config/dist/utils/index.js.map +1 -1
- package/dist/tailwind/dist/config/dist/index.cjs +824 -2
- package/dist/tailwind/dist/config/dist/index.js +824 -2
- package/dist/tailwind/dist/config/dist/index.js.map +1 -1
- package/dist/tailwind/dist/css/utils.cjs +3 -1
- package/dist/tailwind/dist/css/utils.js +3 -1
- package/dist/tailwind/dist/css/utils.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +36 -2
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +36 -2
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +2 -0
- package/dist/tailwind/dist/tailwind/plugins/components.js +3 -1
- package/dist/tailwind/dist/tailwind/plugins/components.js.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/automation/configs/index.cjs +2 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +2 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/index.cjs +2 -0
- package/dist/tokens/index.d.cts +3 -3
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +52 -1
- package/dist/types/dist/index.d.ts +52 -1
- package/dist/uds/generated/componentData.cjs +1457 -1349
- package/dist/uds/generated/componentData.js +1448 -1358
- package/dist/uds/generated/tailwindPurge.cjs +22 -43
- package/dist/uds/generated/tailwindPurge.js +22 -43
- package/dist/uds/package.cjs +2 -2
- package/dist/uds/package.js +2 -2
- package/generated/componentData.json +1808 -1698
- package/generated/tailwindPurge.ts +4 -4
- package/package.json +3 -3
- package/dist/components/experimental/client/Tabs.cjs +0 -76
- package/dist/components/experimental/client/Tabs.d.cts +0 -31
- package/dist/components/experimental/client/Tabs.d.ts +0 -32
- package/dist/components/experimental/client/Tabs.js +0 -71
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalTabProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Tabs/Tab.d.ts
|
|
7
|
+
type TabProps = UniversalTabProps;
|
|
8
|
+
declare function Tab({
|
|
9
|
+
value,
|
|
10
|
+
children,
|
|
11
|
+
startIcon,
|
|
12
|
+
endIcon,
|
|
13
|
+
disabled,
|
|
14
|
+
asChild,
|
|
15
|
+
className
|
|
16
|
+
}: TabProps): react_jsx_runtime0.JSX.Element;
|
|
17
|
+
declare namespace Tab {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Tab, type TabProps };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { IconSlot } from "../../IconSlot.js";
|
|
5
|
+
import { Text } from "../../Text.js";
|
|
6
|
+
import { useTabsContext } from "./tabsContext.js";
|
|
7
|
+
import { isValidElement, useId } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Tab as Tab$1, useStoreState, useTabContext } from "@ariakit/react";
|
|
10
|
+
|
|
11
|
+
//#region src/components/client/Tabs/Tab.tsx
|
|
12
|
+
/** Matches {@link TabList} sliding-indicator underline (token CSS variables on the tab root). */
|
|
13
|
+
const tabRootUnderlineClassName = cx("pointer-events-none absolute bottom-0 left-0 right-0", "h-[var(--uds-tab-underline-width,0px)] bg-[var(--uds-tab-underline-color,transparent)]", "transition-[height,background-color] duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]");
|
|
14
|
+
function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, className }) {
|
|
15
|
+
const generatedId = useId();
|
|
16
|
+
const uid = value ?? `uds-tab-${generatedId}`;
|
|
17
|
+
const { variant, disableMotion } = useTabsContext();
|
|
18
|
+
const store = useTabContext();
|
|
19
|
+
if (!store) throw new Error("Tab must be wrapped in a Tabs component");
|
|
20
|
+
const selectedId = useStoreState(store, "selectedId");
|
|
21
|
+
const activeState = disabled || selectedId !== uid ? "off" : "on";
|
|
22
|
+
const rootBaseClass = getStyles({
|
|
23
|
+
tabSizeRoot: "default",
|
|
24
|
+
tabVariantRoot: variant,
|
|
25
|
+
tabVariantActiveRoot: "off"
|
|
26
|
+
});
|
|
27
|
+
const rootOnClass = getStyles({
|
|
28
|
+
tabSizeRoot: "default",
|
|
29
|
+
tabVariantRoot: variant,
|
|
30
|
+
tabVariantActiveRoot: "on"
|
|
31
|
+
});
|
|
32
|
+
const configClass = activeState === "on" ? cx(rootOnClass, !disableMotion && cx("!bg-transparent", "!shadow-none")) : rootBaseClass;
|
|
33
|
+
const iconConfigClass = getStyles({
|
|
34
|
+
tabSizeIcon: "default",
|
|
35
|
+
tabVariantIcon: variant,
|
|
36
|
+
tabVariantActiveIcon: activeState
|
|
37
|
+
});
|
|
38
|
+
const tabClass = cx(configClass, "inline-flex items-center shrink-0 box-border relative", !disableMotion && "z-[1]", "cursor-pointer select-none whitespace-nowrap", !disabled && "uds-ring", disabled && "opacity-50 cursor-default pointer-events-none", "border-solid border-b-solid", "transition-colors duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]", className);
|
|
39
|
+
const resolvedContent = asChild && isValidElement(children) ? children.props.children ?? null : children;
|
|
40
|
+
return /* @__PURE__ */ jsxs(Tab$1, {
|
|
41
|
+
id: uid,
|
|
42
|
+
disabled,
|
|
43
|
+
className: tabClass,
|
|
44
|
+
render: asChild && isValidElement(children) ? children : void 0,
|
|
45
|
+
children: [
|
|
46
|
+
!(activeState === "on" && !disableMotion) ? /* @__PURE__ */ jsx("div", {
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
className: tabRootUnderlineClassName
|
|
49
|
+
}) : null,
|
|
50
|
+
startIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
51
|
+
icon: startIcon,
|
|
52
|
+
iconProps: {
|
|
53
|
+
size: "sm",
|
|
54
|
+
color: "current"
|
|
55
|
+
},
|
|
56
|
+
className: iconConfigClass
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx(Text, {
|
|
59
|
+
variant: "inherit",
|
|
60
|
+
as: "span",
|
|
61
|
+
color: "current",
|
|
62
|
+
children: resolvedContent
|
|
63
|
+
}),
|
|
64
|
+
endIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
65
|
+
icon: endIcon,
|
|
66
|
+
iconProps: {
|
|
67
|
+
size: "sm",
|
|
68
|
+
color: "current"
|
|
69
|
+
},
|
|
70
|
+
className: iconConfigClass
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
Tab.displayName = "Tab";
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { Tab };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_styles_styler = require('../../../styles/styler.cjs');
|
|
6
|
+
const require_components_client_Tabs_tabsContext = require('./tabsContext.cjs');
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let _ariakit_react = require("@ariakit/react");
|
|
10
|
+
let motion_react = require("motion/react");
|
|
11
|
+
|
|
12
|
+
//#region src/components/client/Tabs/TabList.tsx
|
|
13
|
+
/** Matches {@link Tab} per-tab underline (token CSS variables on the indicator root). */
|
|
14
|
+
const tabRootUnderlineClassName = require_styles_styler.cx("pointer-events-none absolute bottom-0 left-0 right-0", "h-[var(--uds-tab-underline-width,0px)] bg-[var(--uds-tab-underline-color,transparent)]", "transition-[height,background-color] duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]");
|
|
15
|
+
const SELECTION_TRANSITION = "left 240ms cubic-bezier(0.2, 0, 0, 1), top 240ms cubic-bezier(0.2, 0, 0, 1), width 240ms cubic-bezier(0.2, 0, 0, 1), height 240ms cubic-bezier(0.2, 0, 0, 1)";
|
|
16
|
+
/** Token vars set on {@link Tab} roots; the sliding indicator is a sibling, so it must mirror the selected tab's computed values (incl. :hover / :active). */
|
|
17
|
+
const TAB_UNDERLINE_COLOR_VAR = "--uds-tab-underline-color";
|
|
18
|
+
const TAB_UNDERLINE_WIDTH_VAR = "--uds-tab-underline-width";
|
|
19
|
+
const TabList = (0, react.forwardRef)(function TabList({ children, scrollable, className, ...props }, ref) {
|
|
20
|
+
const { variant, disableMotion } = require_components_client_Tabs_tabsContext.useTabsContext();
|
|
21
|
+
const selectedId = (0, _ariakit_react.useStoreState)((0, _ariakit_react.useTabContext)(), "selectedId");
|
|
22
|
+
const listRef = (0, react.useRef)(null);
|
|
23
|
+
const indicatorRef = (0, react.useRef)(null);
|
|
24
|
+
const skipNextTransitionRef = (0, react.useRef)(true);
|
|
25
|
+
const reducedMotion = (0, motion_react.useReducedMotion)();
|
|
26
|
+
const applyIndicator = (0, react.useCallback)(() => {
|
|
27
|
+
const listEl = listRef.current;
|
|
28
|
+
const indicatorEl = indicatorRef.current;
|
|
29
|
+
if (!listEl || !indicatorEl || disableMotion) return;
|
|
30
|
+
const selected = listEl.querySelector("[role=\"tab\"][aria-selected=\"true\"]:not([aria-disabled=\"true\"])");
|
|
31
|
+
if (!selected) {
|
|
32
|
+
indicatorEl.style.opacity = "0";
|
|
33
|
+
indicatorEl.style.transition = "none";
|
|
34
|
+
indicatorEl.style.removeProperty(TAB_UNDERLINE_COLOR_VAR);
|
|
35
|
+
indicatorEl.style.removeProperty(TAB_UNDERLINE_WIDTH_VAR);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const listRect = listEl.getBoundingClientRect();
|
|
39
|
+
const tabRect = selected.getBoundingClientRect();
|
|
40
|
+
const skipTransition = skipNextTransitionRef.current || reducedMotion;
|
|
41
|
+
skipNextTransitionRef.current = false;
|
|
42
|
+
indicatorEl.style.left = `${tabRect.left - listRect.left + listEl.scrollLeft}px`;
|
|
43
|
+
indicatorEl.style.top = `${tabRect.top - listRect.top + listEl.scrollTop}px`;
|
|
44
|
+
indicatorEl.style.width = `${tabRect.width}px`;
|
|
45
|
+
indicatorEl.style.height = `${tabRect.height}px`;
|
|
46
|
+
indicatorEl.style.opacity = "1";
|
|
47
|
+
indicatorEl.style.transition = skipTransition ? "none" : SELECTION_TRANSITION;
|
|
48
|
+
const cs = getComputedStyle(selected);
|
|
49
|
+
const underlineColor = cs.getPropertyValue(TAB_UNDERLINE_COLOR_VAR).trim();
|
|
50
|
+
const underlineWidth = cs.getPropertyValue(TAB_UNDERLINE_WIDTH_VAR).trim();
|
|
51
|
+
if (underlineColor) indicatorEl.style.setProperty(TAB_UNDERLINE_COLOR_VAR, underlineColor);
|
|
52
|
+
else indicatorEl.style.removeProperty(TAB_UNDERLINE_COLOR_VAR);
|
|
53
|
+
if (underlineWidth) indicatorEl.style.setProperty(TAB_UNDERLINE_WIDTH_VAR, underlineWidth);
|
|
54
|
+
else indicatorEl.style.removeProperty(TAB_UNDERLINE_WIDTH_VAR);
|
|
55
|
+
}, [disableMotion, reducedMotion]);
|
|
56
|
+
(0, react.useLayoutEffect)(() => {
|
|
57
|
+
applyIndicator();
|
|
58
|
+
}, [selectedId, applyIndicator]);
|
|
59
|
+
(0, react.useLayoutEffect)(() => {
|
|
60
|
+
if (disableMotion) return;
|
|
61
|
+
const listEl = listRef.current;
|
|
62
|
+
if (!listEl) return;
|
|
63
|
+
const ro = new ResizeObserver(() => applyIndicator());
|
|
64
|
+
ro.observe(listEl);
|
|
65
|
+
const onScroll = () => applyIndicator();
|
|
66
|
+
listEl.addEventListener("scroll", onScroll, { passive: true });
|
|
67
|
+
window.addEventListener("resize", applyIndicator);
|
|
68
|
+
return () => {
|
|
69
|
+
ro.disconnect();
|
|
70
|
+
listEl.removeEventListener("scroll", onScroll);
|
|
71
|
+
window.removeEventListener("resize", applyIndicator);
|
|
72
|
+
};
|
|
73
|
+
}, [disableMotion, applyIndicator]);
|
|
74
|
+
/** Re-sync underline tokens when the selected tab's hover/pressed state changes (indicator does not receive those pseudos). */
|
|
75
|
+
(0, react.useLayoutEffect)(() => {
|
|
76
|
+
if (disableMotion) return;
|
|
77
|
+
const listEl = listRef.current;
|
|
78
|
+
if (!listEl) return;
|
|
79
|
+
const selected = listEl.querySelector("[role=\"tab\"][aria-selected=\"true\"]:not([aria-disabled=\"true\"])");
|
|
80
|
+
if (!selected) return;
|
|
81
|
+
const bump = () => applyIndicator();
|
|
82
|
+
const events = [
|
|
83
|
+
"mouseenter",
|
|
84
|
+
"mouseleave",
|
|
85
|
+
"mousedown",
|
|
86
|
+
"mouseup",
|
|
87
|
+
"pointerdown",
|
|
88
|
+
"pointerup"
|
|
89
|
+
];
|
|
90
|
+
events.forEach((e) => selected.addEventListener(e, bump));
|
|
91
|
+
return () => events.forEach((e) => selected.removeEventListener(e, bump));
|
|
92
|
+
}, [
|
|
93
|
+
selectedId,
|
|
94
|
+
disableMotion,
|
|
95
|
+
applyIndicator
|
|
96
|
+
]);
|
|
97
|
+
const setListRef = (el) => {
|
|
98
|
+
listRef.current = el;
|
|
99
|
+
if (typeof ref === "function") ref(el);
|
|
100
|
+
else if (ref) ref.current = el;
|
|
101
|
+
};
|
|
102
|
+
const tablistConfigClass = require_styles_styler.getStyles({ tabsVariantRoot: variant });
|
|
103
|
+
const indicatorClass = require_styles_styler.cx(require_styles_styler.getStyles({
|
|
104
|
+
tabSizeRoot: "default",
|
|
105
|
+
tabVariantRoot: variant,
|
|
106
|
+
tabVariantActiveRoot: "on"
|
|
107
|
+
}), "!m-0 !p-0 !gap-0 box-border pointer-events-none", "absolute z-0 min-w-0 min-h-0");
|
|
108
|
+
const styles = require_styles_styler.cx(tablistConfigClass, "flex flex-row items-center", scrollable ? "overflow-x-auto overflow-y-clip scrollbar-none [overflow-clip-margin:6px]" : "overflow-clip [overflow-clip-margin:8px]", !disableMotion && "relative", className);
|
|
109
|
+
const indicatorBoxStyle = !disableMotion ? {
|
|
110
|
+
opacity: 0,
|
|
111
|
+
transition: "none"
|
|
112
|
+
} : {};
|
|
113
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ariakit_react.TabList, {
|
|
114
|
+
ref: setListRef,
|
|
115
|
+
className: styles,
|
|
116
|
+
...props,
|
|
117
|
+
children: [!disableMotion ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
118
|
+
ref: indicatorRef,
|
|
119
|
+
className: indicatorClass,
|
|
120
|
+
style: indicatorBoxStyle,
|
|
121
|
+
"aria-hidden": true,
|
|
122
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
123
|
+
"aria-hidden": true,
|
|
124
|
+
className: tabRootUnderlineClassName
|
|
125
|
+
})
|
|
126
|
+
}) : null, children]
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
TabList.displayName = "TabList";
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.TabList = TabList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTabListProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tabs/TabList.d.ts
|
|
6
|
+
type TabListProps = UniversalTabListProps;
|
|
7
|
+
declare const TabList: react.ForwardRefExoticComponent<UniversalTabListProps & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { TabList, type TabListProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalTabListProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Tabs/TabList.d.ts
|
|
7
|
+
type TabListProps = UniversalTabListProps;
|
|
8
|
+
declare const TabList: react.ForwardRefExoticComponent<UniversalTabListProps & react.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TabList, type TabListProps };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { useTabsContext } from "./tabsContext.js";
|
|
5
|
+
import { forwardRef, useCallback, useLayoutEffect, useRef } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { TabList as TabList$1, useStoreState, useTabContext } from "@ariakit/react";
|
|
8
|
+
import { useReducedMotion } from "motion/react";
|
|
9
|
+
|
|
10
|
+
//#region src/components/client/Tabs/TabList.tsx
|
|
11
|
+
/** Matches {@link Tab} per-tab underline (token CSS variables on the indicator root). */
|
|
12
|
+
const tabRootUnderlineClassName = cx("pointer-events-none absolute bottom-0 left-0 right-0", "h-[var(--uds-tab-underline-width,0px)] bg-[var(--uds-tab-underline-color,transparent)]", "transition-[height,background-color] duration-[240ms] ease-[cubic-bezier(0.2,0,0,1)]");
|
|
13
|
+
const SELECTION_TRANSITION = "left 240ms cubic-bezier(0.2, 0, 0, 1), top 240ms cubic-bezier(0.2, 0, 0, 1), width 240ms cubic-bezier(0.2, 0, 0, 1), height 240ms cubic-bezier(0.2, 0, 0, 1)";
|
|
14
|
+
/** Token vars set on {@link Tab} roots; the sliding indicator is a sibling, so it must mirror the selected tab's computed values (incl. :hover / :active). */
|
|
15
|
+
const TAB_UNDERLINE_COLOR_VAR = "--uds-tab-underline-color";
|
|
16
|
+
const TAB_UNDERLINE_WIDTH_VAR = "--uds-tab-underline-width";
|
|
17
|
+
const TabList = forwardRef(function TabList({ children, scrollable, className, ...props }, ref) {
|
|
18
|
+
const { variant, disableMotion } = useTabsContext();
|
|
19
|
+
const selectedId = useStoreState(useTabContext(), "selectedId");
|
|
20
|
+
const listRef = useRef(null);
|
|
21
|
+
const indicatorRef = useRef(null);
|
|
22
|
+
const skipNextTransitionRef = useRef(true);
|
|
23
|
+
const reducedMotion = useReducedMotion();
|
|
24
|
+
const applyIndicator = useCallback(() => {
|
|
25
|
+
const listEl = listRef.current;
|
|
26
|
+
const indicatorEl = indicatorRef.current;
|
|
27
|
+
if (!listEl || !indicatorEl || disableMotion) return;
|
|
28
|
+
const selected = listEl.querySelector("[role=\"tab\"][aria-selected=\"true\"]:not([aria-disabled=\"true\"])");
|
|
29
|
+
if (!selected) {
|
|
30
|
+
indicatorEl.style.opacity = "0";
|
|
31
|
+
indicatorEl.style.transition = "none";
|
|
32
|
+
indicatorEl.style.removeProperty(TAB_UNDERLINE_COLOR_VAR);
|
|
33
|
+
indicatorEl.style.removeProperty(TAB_UNDERLINE_WIDTH_VAR);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const listRect = listEl.getBoundingClientRect();
|
|
37
|
+
const tabRect = selected.getBoundingClientRect();
|
|
38
|
+
const skipTransition = skipNextTransitionRef.current || reducedMotion;
|
|
39
|
+
skipNextTransitionRef.current = false;
|
|
40
|
+
indicatorEl.style.left = `${tabRect.left - listRect.left + listEl.scrollLeft}px`;
|
|
41
|
+
indicatorEl.style.top = `${tabRect.top - listRect.top + listEl.scrollTop}px`;
|
|
42
|
+
indicatorEl.style.width = `${tabRect.width}px`;
|
|
43
|
+
indicatorEl.style.height = `${tabRect.height}px`;
|
|
44
|
+
indicatorEl.style.opacity = "1";
|
|
45
|
+
indicatorEl.style.transition = skipTransition ? "none" : SELECTION_TRANSITION;
|
|
46
|
+
const cs = getComputedStyle(selected);
|
|
47
|
+
const underlineColor = cs.getPropertyValue(TAB_UNDERLINE_COLOR_VAR).trim();
|
|
48
|
+
const underlineWidth = cs.getPropertyValue(TAB_UNDERLINE_WIDTH_VAR).trim();
|
|
49
|
+
if (underlineColor) indicatorEl.style.setProperty(TAB_UNDERLINE_COLOR_VAR, underlineColor);
|
|
50
|
+
else indicatorEl.style.removeProperty(TAB_UNDERLINE_COLOR_VAR);
|
|
51
|
+
if (underlineWidth) indicatorEl.style.setProperty(TAB_UNDERLINE_WIDTH_VAR, underlineWidth);
|
|
52
|
+
else indicatorEl.style.removeProperty(TAB_UNDERLINE_WIDTH_VAR);
|
|
53
|
+
}, [disableMotion, reducedMotion]);
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
applyIndicator();
|
|
56
|
+
}, [selectedId, applyIndicator]);
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
if (disableMotion) return;
|
|
59
|
+
const listEl = listRef.current;
|
|
60
|
+
if (!listEl) return;
|
|
61
|
+
const ro = new ResizeObserver(() => applyIndicator());
|
|
62
|
+
ro.observe(listEl);
|
|
63
|
+
const onScroll = () => applyIndicator();
|
|
64
|
+
listEl.addEventListener("scroll", onScroll, { passive: true });
|
|
65
|
+
window.addEventListener("resize", applyIndicator);
|
|
66
|
+
return () => {
|
|
67
|
+
ro.disconnect();
|
|
68
|
+
listEl.removeEventListener("scroll", onScroll);
|
|
69
|
+
window.removeEventListener("resize", applyIndicator);
|
|
70
|
+
};
|
|
71
|
+
}, [disableMotion, applyIndicator]);
|
|
72
|
+
/** Re-sync underline tokens when the selected tab's hover/pressed state changes (indicator does not receive those pseudos). */
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
if (disableMotion) return;
|
|
75
|
+
const listEl = listRef.current;
|
|
76
|
+
if (!listEl) return;
|
|
77
|
+
const selected = listEl.querySelector("[role=\"tab\"][aria-selected=\"true\"]:not([aria-disabled=\"true\"])");
|
|
78
|
+
if (!selected) return;
|
|
79
|
+
const bump = () => applyIndicator();
|
|
80
|
+
const events = [
|
|
81
|
+
"mouseenter",
|
|
82
|
+
"mouseleave",
|
|
83
|
+
"mousedown",
|
|
84
|
+
"mouseup",
|
|
85
|
+
"pointerdown",
|
|
86
|
+
"pointerup"
|
|
87
|
+
];
|
|
88
|
+
events.forEach((e) => selected.addEventListener(e, bump));
|
|
89
|
+
return () => events.forEach((e) => selected.removeEventListener(e, bump));
|
|
90
|
+
}, [
|
|
91
|
+
selectedId,
|
|
92
|
+
disableMotion,
|
|
93
|
+
applyIndicator
|
|
94
|
+
]);
|
|
95
|
+
const setListRef = (el) => {
|
|
96
|
+
listRef.current = el;
|
|
97
|
+
if (typeof ref === "function") ref(el);
|
|
98
|
+
else if (ref) ref.current = el;
|
|
99
|
+
};
|
|
100
|
+
const tablistConfigClass = getStyles({ tabsVariantRoot: variant });
|
|
101
|
+
const indicatorClass = cx(getStyles({
|
|
102
|
+
tabSizeRoot: "default",
|
|
103
|
+
tabVariantRoot: variant,
|
|
104
|
+
tabVariantActiveRoot: "on"
|
|
105
|
+
}), "!m-0 !p-0 !gap-0 box-border pointer-events-none", "absolute z-0 min-w-0 min-h-0");
|
|
106
|
+
const styles = cx(tablistConfigClass, "flex flex-row items-center", scrollable ? "overflow-x-auto overflow-y-clip scrollbar-none [overflow-clip-margin:6px]" : "overflow-clip [overflow-clip-margin:8px]", !disableMotion && "relative", className);
|
|
107
|
+
const indicatorBoxStyle = !disableMotion ? {
|
|
108
|
+
opacity: 0,
|
|
109
|
+
transition: "none"
|
|
110
|
+
} : {};
|
|
111
|
+
return /* @__PURE__ */ jsxs(TabList$1, {
|
|
112
|
+
ref: setListRef,
|
|
113
|
+
className: styles,
|
|
114
|
+
...props,
|
|
115
|
+
children: [!disableMotion ? /* @__PURE__ */ jsx("span", {
|
|
116
|
+
ref: indicatorRef,
|
|
117
|
+
className: indicatorClass,
|
|
118
|
+
style: indicatorBoxStyle,
|
|
119
|
+
"aria-hidden": true,
|
|
120
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
121
|
+
"aria-hidden": true,
|
|
122
|
+
className: tabRootUnderlineClassName
|
|
123
|
+
})
|
|
124
|
+
}) : null, children]
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
TabList.displayName = "TabList";
|
|
128
|
+
|
|
129
|
+
//#endregion
|
|
130
|
+
export { TabList };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _ariakit_react = require("@ariakit/react");
|
|
8
|
+
|
|
9
|
+
//#region src/components/client/Tabs/TabPanel.tsx
|
|
10
|
+
const TabPanel = (0, react.forwardRef)(function TabPanel({ tabId, children, className, ...props }, ref) {
|
|
11
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TabPanel, {
|
|
12
|
+
ref,
|
|
13
|
+
tabId,
|
|
14
|
+
className,
|
|
15
|
+
...props,
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
TabPanel.displayName = "TabPanel";
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.TabPanel = TabPanel;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTabPanelProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tabs/TabPanel.d.ts
|
|
6
|
+
type TabPanelProps = UniversalTabPanelProps;
|
|
7
|
+
declare const TabPanel: react.ForwardRefExoticComponent<UniversalTabPanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { TabPanel, type TabPanelProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalTabPanelProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Tabs/TabPanel.d.ts
|
|
7
|
+
type TabPanelProps = UniversalTabPanelProps;
|
|
8
|
+
declare const TabPanel: react.ForwardRefExoticComponent<UniversalTabPanelProps & react.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TabPanel, type TabPanelProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { TabPanel as TabPanel$1 } from "@ariakit/react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Tabs/TabPanel.tsx
|
|
8
|
+
const TabPanel = forwardRef(function TabPanel({ tabId, children, className, ...props }, ref) {
|
|
9
|
+
return /* @__PURE__ */ jsx(TabPanel$1, {
|
|
10
|
+
ref,
|
|
11
|
+
tabId,
|
|
12
|
+
className,
|
|
13
|
+
...props,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
TabPanel.displayName = "TabPanel";
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { TabPanel };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_components_client_Tabs_tabsContext = require('./tabsContext.cjs');
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _ariakit_react = require("@ariakit/react");
|
|
8
|
+
|
|
9
|
+
//#region src/components/client/Tabs/Tabs.tsx
|
|
10
|
+
/**
|
|
11
|
+
* **⚙️️ A composable Tabs component
|
|
12
|
+
*
|
|
13
|
+
* @componentType Client component
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* Tabs organize content into multiple sections and allow users to navigate between them.
|
|
17
|
+
* Supports two visual variants: `primary` and `secondary`. By default, the active selection
|
|
18
|
+
* indicator (underline or pill) animates between tabs with the same timing as the design reference
|
|
19
|
+
* (`240ms` and `cubic-bezier(0.2, 0, 0, 1)`). Set `disableMotion={true}` to disable that motion.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* 'use client';
|
|
24
|
+
* import { Tabs, TabList, Tab, TabPanel } from "@yahoo/uds";
|
|
25
|
+
*
|
|
26
|
+
* <Tabs variant="primary" defaultSelectedId="tab-home">
|
|
27
|
+
* <TabList aria-label="Navigation">
|
|
28
|
+
* <Tab value="tab-home">Home</Tab>
|
|
29
|
+
* <Tab value="tab-about">About</Tab>
|
|
30
|
+
* </TabList>
|
|
31
|
+
* <TabPanel tabId="tab-home">Home content</TabPanel>
|
|
32
|
+
* <TabPanel tabId="tab-about">About content</TabPanel>
|
|
33
|
+
* </Tabs>
|
|
34
|
+
* ```
|
|
35
|
+
**/
|
|
36
|
+
function Tabs({ children, variant = "primary", disableMotion = false, defaultSelectedId, selectedId, onSelectionChange }) {
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Tabs_tabsContext.TabsContext.Provider, {
|
|
38
|
+
value: {
|
|
39
|
+
variant,
|
|
40
|
+
disableMotion
|
|
41
|
+
},
|
|
42
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TabProvider, {
|
|
43
|
+
defaultSelectedId,
|
|
44
|
+
selectedId,
|
|
45
|
+
setSelectedId: onSelectionChange,
|
|
46
|
+
children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
Tabs.displayName = "Tabs";
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.Tabs = Tabs;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTabsProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tabs/Tabs.d.ts
|
|
6
|
+
type TabsProps = UniversalTabsProps;
|
|
7
|
+
/**
|
|
8
|
+
* **⚙️️ A composable Tabs component
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Tabs organize content into multiple sections and allow users to navigate between them.
|
|
14
|
+
* Supports two visual variants: `primary` and `secondary`. By default, the active selection
|
|
15
|
+
* indicator (underline or pill) animates between tabs with the same timing as the design reference
|
|
16
|
+
* (`240ms` and `cubic-bezier(0.2, 0, 0, 1)`). Set `disableMotion={true}` to disable that motion.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* 'use client';
|
|
21
|
+
* import { Tabs, TabList, Tab, TabPanel } from "@yahoo/uds";
|
|
22
|
+
*
|
|
23
|
+
* <Tabs variant="primary" defaultSelectedId="tab-home">
|
|
24
|
+
* <TabList aria-label="Navigation">
|
|
25
|
+
* <Tab value="tab-home">Home</Tab>
|
|
26
|
+
* <Tab value="tab-about">About</Tab>
|
|
27
|
+
* </TabList>
|
|
28
|
+
* <TabPanel tabId="tab-home">Home content</TabPanel>
|
|
29
|
+
* <TabPanel tabId="tab-about">About content</TabPanel>
|
|
30
|
+
* </Tabs>
|
|
31
|
+
* ```
|
|
32
|
+
**/
|
|
33
|
+
declare function Tabs({
|
|
34
|
+
children,
|
|
35
|
+
variant,
|
|
36
|
+
disableMotion,
|
|
37
|
+
defaultSelectedId,
|
|
38
|
+
selectedId,
|
|
39
|
+
onSelectionChange
|
|
40
|
+
}: TabsProps): react_jsx_runtime0.JSX.Element;
|
|
41
|
+
declare namespace Tabs {
|
|
42
|
+
var displayName: string;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Tabs, type TabsProps };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalTabsProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Tabs/Tabs.d.ts
|
|
7
|
+
type TabsProps = UniversalTabsProps;
|
|
8
|
+
/**
|
|
9
|
+
* **⚙️️ A composable Tabs component
|
|
10
|
+
*
|
|
11
|
+
* @componentType Client component
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Tabs organize content into multiple sections and allow users to navigate between them.
|
|
15
|
+
* Supports two visual variants: `primary` and `secondary`. By default, the active selection
|
|
16
|
+
* indicator (underline or pill) animates between tabs with the same timing as the design reference
|
|
17
|
+
* (`240ms` and `cubic-bezier(0.2, 0, 0, 1)`). Set `disableMotion={true}` to disable that motion.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* 'use client';
|
|
22
|
+
* import { Tabs, TabList, Tab, TabPanel } from "@yahoo/uds";
|
|
23
|
+
*
|
|
24
|
+
* <Tabs variant="primary" defaultSelectedId="tab-home">
|
|
25
|
+
* <TabList aria-label="Navigation">
|
|
26
|
+
* <Tab value="tab-home">Home</Tab>
|
|
27
|
+
* <Tab value="tab-about">About</Tab>
|
|
28
|
+
* </TabList>
|
|
29
|
+
* <TabPanel tabId="tab-home">Home content</TabPanel>
|
|
30
|
+
* <TabPanel tabId="tab-about">About content</TabPanel>
|
|
31
|
+
* </Tabs>
|
|
32
|
+
* ```
|
|
33
|
+
**/
|
|
34
|
+
declare function Tabs({
|
|
35
|
+
children,
|
|
36
|
+
variant,
|
|
37
|
+
disableMotion,
|
|
38
|
+
defaultSelectedId,
|
|
39
|
+
selectedId,
|
|
40
|
+
onSelectionChange
|
|
41
|
+
}: TabsProps): react_jsx_runtime0.JSX.Element;
|
|
42
|
+
declare namespace Tabs {
|
|
43
|
+
var displayName: string;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Tabs, type TabsProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { TabsContext } from "./tabsContext.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { TabProvider } from "@ariakit/react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Tabs/Tabs.tsx
|
|
8
|
+
/**
|
|
9
|
+
* **⚙️️ A composable Tabs component
|
|
10
|
+
*
|
|
11
|
+
* @componentType Client component
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Tabs organize content into multiple sections and allow users to navigate between them.
|
|
15
|
+
* Supports two visual variants: `primary` and `secondary`. By default, the active selection
|
|
16
|
+
* indicator (underline or pill) animates between tabs with the same timing as the design reference
|
|
17
|
+
* (`240ms` and `cubic-bezier(0.2, 0, 0, 1)`). Set `disableMotion={true}` to disable that motion.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* 'use client';
|
|
22
|
+
* import { Tabs, TabList, Tab, TabPanel } from "@yahoo/uds";
|
|
23
|
+
*
|
|
24
|
+
* <Tabs variant="primary" defaultSelectedId="tab-home">
|
|
25
|
+
* <TabList aria-label="Navigation">
|
|
26
|
+
* <Tab value="tab-home">Home</Tab>
|
|
27
|
+
* <Tab value="tab-about">About</Tab>
|
|
28
|
+
* </TabList>
|
|
29
|
+
* <TabPanel tabId="tab-home">Home content</TabPanel>
|
|
30
|
+
* <TabPanel tabId="tab-about">About content</TabPanel>
|
|
31
|
+
* </Tabs>
|
|
32
|
+
* ```
|
|
33
|
+
**/
|
|
34
|
+
function Tabs({ children, variant = "primary", disableMotion = false, defaultSelectedId, selectedId, onSelectionChange }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, {
|
|
36
|
+
value: {
|
|
37
|
+
variant,
|
|
38
|
+
disableMotion
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ jsx(TabProvider, {
|
|
41
|
+
defaultSelectedId,
|
|
42
|
+
selectedId,
|
|
43
|
+
setSelectedId: onSelectionChange,
|
|
44
|
+
children
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
Tabs.displayName = "Tabs";
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Tabs };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_components_client_Tabs_Tab = require('./Tab.cjs');
|
|
5
|
+
const require_components_client_Tabs_TabList = require('./TabList.cjs');
|
|
6
|
+
const require_components_client_Tabs_TabPanel = require('./TabPanel.cjs');
|
|
7
|
+
const require_components_client_Tabs_Tabs = require('./Tabs.cjs');
|
|
8
|
+
|
|
9
|
+
exports.Tab = require_components_client_Tabs_Tab.Tab;
|
|
10
|
+
exports.TabList = require_components_client_Tabs_TabList.TabList;
|
|
11
|
+
exports.TabPanel = require_components_client_Tabs_TabPanel.TabPanel;
|
|
12
|
+
exports.Tabs = require_components_client_Tabs_Tabs.Tabs;
|