@yahoo/uds-mobile 2.9.0 → 2.10.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/README.md +1 -1
- package/dist/components/Tabs/Tab.cjs +174 -0
- package/dist/components/Tabs/Tab.d.cts +26 -0
- package/dist/components/Tabs/Tab.d.cts.map +1 -0
- package/dist/components/Tabs/Tab.d.ts +26 -0
- package/dist/components/Tabs/Tab.d.ts.map +1 -0
- package/dist/components/Tabs/Tab.js +174 -0
- package/dist/components/Tabs/Tab.js.map +1 -0
- package/dist/components/Tabs/TabList.cjs +142 -0
- package/dist/components/Tabs/TabList.d.cts +24 -0
- package/dist/components/Tabs/TabList.d.cts.map +1 -0
- package/dist/components/Tabs/TabList.d.ts +24 -0
- package/dist/components/Tabs/TabList.d.ts.map +1 -0
- package/dist/components/Tabs/TabList.js +141 -0
- package/dist/components/Tabs/TabList.js.map +1 -0
- package/dist/components/Tabs/TabPanel.cjs +31 -0
- package/dist/components/Tabs/TabPanel.d.cts +24 -0
- package/dist/components/Tabs/TabPanel.d.cts.map +1 -0
- package/dist/components/Tabs/TabPanel.d.ts +24 -0
- package/dist/components/Tabs/TabPanel.d.ts.map +1 -0
- package/dist/components/Tabs/TabPanel.js +31 -0
- package/dist/components/Tabs/TabPanel.js.map +1 -0
- package/dist/components/Tabs/Tabs.cjs +53 -0
- package/dist/components/Tabs/Tabs.d.cts +35 -0
- package/dist/components/Tabs/Tabs.d.cts.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +35 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +53 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/index.cjs +10 -0
- package/dist/components/Tabs/index.d.cts +13 -0
- package/dist/components/Tabs/index.d.cts.map +1 -0
- package/dist/components/Tabs/index.d.ts +13 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +6 -0
- package/dist/components/Tabs/tabTheme.cjs +29 -0
- package/dist/components/Tabs/tabTheme.d.cts +23 -0
- package/dist/components/Tabs/tabTheme.d.cts.map +1 -0
- package/dist/components/Tabs/tabTheme.d.ts +23 -0
- package/dist/components/Tabs/tabTheme.d.ts.map +1 -0
- package/dist/components/Tabs/tabTheme.js +28 -0
- package/dist/components/Tabs/tabTheme.js.map +1 -0
- package/dist/components/Tabs/tabsContexts.cjs +91 -0
- package/dist/components/Tabs/tabsContexts.d.cts +35 -0
- package/dist/components/Tabs/tabsContexts.d.cts.map +1 -0
- package/dist/components/Tabs/tabsContexts.d.ts +35 -0
- package/dist/components/Tabs/tabsContexts.d.ts.map +1 -0
- package/dist/components/Tabs/tabsContexts.js +87 -0
- package/dist/components/Tabs/tabsContexts.js.map +1 -0
- package/dist/jest/mocks/styles.cjs +7 -0
- package/dist/jest/mocks/styles.d.cts +3 -2
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts +3 -2
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +7 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/types/dist/index.d.cts +52 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts +52 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/generated/styles.cjs +68 -0
- package/generated/styles.d.ts +46 -0
- package/generated/styles.mjs +68 -0
- package/generated/unistyles.d.ts +53 -0
- package/package.json +11 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
//#region src/components/Tabs/tabTheme.ts
|
|
3
|
+
function tabComponentPath(visual, active, layer, state) {
|
|
4
|
+
return `tab/variant/${visual}/active/${active}/${layer === "rootText" ? "rootText" : layer}/${state}`;
|
|
5
|
+
}
|
|
6
|
+
/** Default tab dimensions / spacing from tokens (`tab/size/default/...`). */
|
|
7
|
+
function getTabSizeLayerStyle(theme, layer) {
|
|
8
|
+
const path = `tab/size/default/${layer}/rest`;
|
|
9
|
+
const s = theme.components[path];
|
|
10
|
+
return s && typeof s === "object" ? s : {};
|
|
11
|
+
}
|
|
12
|
+
/** Variant + interaction layer (active on/off, pressed/rest). */
|
|
13
|
+
function getTabLayerStyle(theme, visual, active, layer, state) {
|
|
14
|
+
const path = tabComponentPath(visual, active, layer, state);
|
|
15
|
+
const s = theme.components[path];
|
|
16
|
+
return s && typeof s === "object" ? s : {};
|
|
17
|
+
}
|
|
18
|
+
/** Size tokens + variant state (matches web stacking size + variant classes). */
|
|
19
|
+
function getMergedTabLayerStyle(theme, visual, active, layer, state) {
|
|
20
|
+
return {
|
|
21
|
+
...getTabSizeLayerStyle(theme, layer === "rootText" ? "rootText" : layer === "icon" ? "icon" : "root"),
|
|
22
|
+
...getTabLayerStyle(theme, visual, active, layer, state)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { getMergedTabLayerStyle, getTabLayerStyle, getTabSizeLayerStyle };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=tabTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabTheme.js","names":[],"sources":["../../../src/components/Tabs/tabTheme.ts"],"sourcesContent":["import type { UniversalTabsVariant } from '@yahoo/uds-types';\nimport type { TextStyle, ViewStyle } from 'react-native';\n\ntype TabActiveState = 'on' | 'off';\ntype TabLayer = 'root' | 'rootText' | 'icon';\ntype InteractionState = 'rest' | 'pressed';\n\nfunction tabComponentPath(\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): string {\n const layerKey = layer === 'rootText' ? 'rootText' : layer;\n return `tab/variant/${visual}/active/${active}/${layerKey}/${state}`;\n}\n\n/** Default tab dimensions / spacing from tokens (`tab/size/default/...`). */\nexport function getTabSizeLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n layer: 'root' | 'rootText' | 'icon',\n): ViewStyle | TextStyle {\n const path = `tab/size/default/${layer}/rest`;\n const s = theme.components[path];\n return s && typeof s === 'object' ? s : {};\n}\n\n/** Variant + interaction layer (active on/off, pressed/rest). */\nexport function getTabLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): ViewStyle | TextStyle {\n const path = tabComponentPath(visual, active, layer, state);\n const s = theme.components[path];\n return s && typeof s === 'object' ? s : {};\n}\n\n/** Size tokens + variant state (matches web stacking size + variant classes). */\nexport function getMergedTabLayerStyle(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n theme: { components: Record<string, any> },\n visual: UniversalTabsVariant,\n active: TabActiveState,\n layer: TabLayer,\n state: InteractionState,\n): ViewStyle | TextStyle {\n const sizeKey = layer === 'rootText' ? 'rootText' : layer === 'icon' ? 'icon' : 'root';\n return {\n ...(getTabSizeLayerStyle(theme, sizeKey) as object),\n ...(getTabLayerStyle(theme, visual, active, layer, state) as object),\n } as ViewStyle;\n}\n"],"mappings":";;AAOA,SAAS,iBACP,QACA,QACA,OACA,OACQ;AAER,QAAO,eAAe,OAAO,UAAU,OAAO,GAD7B,UAAU,aAAa,aAAa,MACK,GAAG;;;AAI/D,SAAgB,qBAEd,OACA,OACuB;CACvB,MAAM,OAAO,oBAAoB,MAAM;CACvC,MAAM,IAAI,MAAM,WAAW;AAC3B,QAAO,KAAK,OAAO,MAAM,WAAW,IAAI,EAAE;;;AAI5C,SAAgB,iBAEd,OACA,QACA,QACA,OACA,OACuB;CACvB,MAAM,OAAO,iBAAiB,QAAQ,QAAQ,OAAO,MAAM;CAC3D,MAAM,IAAI,MAAM,WAAW;AAC3B,QAAO,KAAK,OAAO,MAAM,WAAW,IAAI,EAAE;;;AAI5C,SAAgB,uBAEd,OACA,QACA,QACA,OACA,OACuB;AAEvB,QAAO;EACL,GAAI,qBAAqB,OAFX,UAAU,aAAa,aAAa,UAAU,SAAS,SAAS,OAEtC;EACxC,GAAI,iBAAiB,OAAO,QAAQ,QAAQ,OAAO,MAAM;EAC1D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
//#region src/components/Tabs/tabsContexts.tsx
|
|
6
|
+
const TabsVisualContext = (0, react.createContext)({
|
|
7
|
+
variant: "primary",
|
|
8
|
+
reduceMotion: false
|
|
9
|
+
});
|
|
10
|
+
function useTabsVisualContext() {
|
|
11
|
+
return (0, react.useContext)(TabsVisualContext);
|
|
12
|
+
}
|
|
13
|
+
const TabSelectionContext = (0, react.createContext)(null);
|
|
14
|
+
function useTabSelectionContext() {
|
|
15
|
+
const ctx = (0, react.useContext)(TabSelectionContext);
|
|
16
|
+
if (!ctx) throw new Error("Tab components must be used within <Tabs>");
|
|
17
|
+
return ctx;
|
|
18
|
+
}
|
|
19
|
+
function useTabSelectionState({ defaultSelectedId, selectedId: selectedIdProp, onSelectionChange }) {
|
|
20
|
+
const isControlled = selectedIdProp !== void 0;
|
|
21
|
+
const [internalSelectedId, setInternalSelectedId] = (0, react.useState)(defaultSelectedId ?? null);
|
|
22
|
+
const [registeredIds, setRegisteredIds] = (0, react.useState)([]);
|
|
23
|
+
const [tabLayouts, setTabLayouts] = (0, react.useState)(() => /* @__PURE__ */ new Map());
|
|
24
|
+
const selectedId = isControlled ? selectedIdProp : internalSelectedId;
|
|
25
|
+
const setSelectedId = (0, react.useCallback)((id) => {
|
|
26
|
+
if (!isControlled) setInternalSelectedId(id);
|
|
27
|
+
onSelectionChange?.(id);
|
|
28
|
+
}, [isControlled, onSelectionChange]);
|
|
29
|
+
const registerTab = (0, react.useCallback)((id) => {
|
|
30
|
+
setRegisteredIds((prev) => prev.includes(id) ? prev : [...prev, id]);
|
|
31
|
+
}, []);
|
|
32
|
+
const unregisterTab = (0, react.useCallback)((id) => {
|
|
33
|
+
setRegisteredIds((prev) => prev.filter((x) => x !== id));
|
|
34
|
+
setTabLayouts((prev) => {
|
|
35
|
+
const next = new Map(prev);
|
|
36
|
+
next.delete(id);
|
|
37
|
+
return next;
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
const setTabLayout = (0, react.useCallback)((id, layout) => {
|
|
41
|
+
setTabLayouts((prev) => {
|
|
42
|
+
const cur = prev.get(id);
|
|
43
|
+
if (cur && cur.x === layout.x && cur.y === layout.y && cur.width === layout.width && cur.height === layout.height) return prev;
|
|
44
|
+
const next = new Map(prev);
|
|
45
|
+
next.set(id, layout);
|
|
46
|
+
return next;
|
|
47
|
+
});
|
|
48
|
+
}, []);
|
|
49
|
+
const clearTabLayout = (0, react.useCallback)((id) => {
|
|
50
|
+
setTabLayouts((prev) => {
|
|
51
|
+
if (!prev.has(id)) return prev;
|
|
52
|
+
const next = new Map(prev);
|
|
53
|
+
next.delete(id);
|
|
54
|
+
return next;
|
|
55
|
+
});
|
|
56
|
+
}, []);
|
|
57
|
+
(0, react.useEffect)(() => {
|
|
58
|
+
if (isControlled || defaultSelectedId !== void 0) return;
|
|
59
|
+
if (internalSelectedId !== null) return;
|
|
60
|
+
if (registeredIds.length === 0) return;
|
|
61
|
+
setInternalSelectedId(registeredIds[0]);
|
|
62
|
+
}, [
|
|
63
|
+
isControlled,
|
|
64
|
+
defaultSelectedId,
|
|
65
|
+
internalSelectedId,
|
|
66
|
+
registeredIds
|
|
67
|
+
]);
|
|
68
|
+
return (0, react.useMemo)(() => ({
|
|
69
|
+
selectedId,
|
|
70
|
+
setSelectedId,
|
|
71
|
+
registerTab,
|
|
72
|
+
unregisterTab,
|
|
73
|
+
tabLayouts,
|
|
74
|
+
setTabLayout,
|
|
75
|
+
clearTabLayout
|
|
76
|
+
}), [
|
|
77
|
+
selectedId,
|
|
78
|
+
setSelectedId,
|
|
79
|
+
registerTab,
|
|
80
|
+
unregisterTab,
|
|
81
|
+
tabLayouts,
|
|
82
|
+
setTabLayout,
|
|
83
|
+
clearTabLayout
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
exports.TabSelectionContext = TabSelectionContext;
|
|
88
|
+
exports.TabsVisualContext = TabsVisualContext;
|
|
89
|
+
exports.useTabSelectionContext = useTabSelectionContext;
|
|
90
|
+
exports.useTabSelectionState = useTabSelectionState;
|
|
91
|
+
exports.useTabsVisualContext = useTabsVisualContext;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTabsVariant } from "../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { LayoutRectangle } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Tabs/tabsContexts.d.ts
|
|
7
|
+
interface TabsVisualContextValue {
|
|
8
|
+
variant: UniversalTabsVariant;
|
|
9
|
+
reduceMotion: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const TabsVisualContext: _$react.Context<TabsVisualContextValue>;
|
|
12
|
+
declare function useTabsVisualContext(): TabsVisualContextValue;
|
|
13
|
+
interface TabSelectionContextValue {
|
|
14
|
+
selectedId: string | null | undefined;
|
|
15
|
+
setSelectedId: (id: string) => void;
|
|
16
|
+
registerTab: (id: string) => void;
|
|
17
|
+
unregisterTab: (id: string) => void;
|
|
18
|
+
tabLayouts: ReadonlyMap<string, LayoutRectangle>;
|
|
19
|
+
setTabLayout: (id: string, layout: LayoutRectangle) => void;
|
|
20
|
+
clearTabLayout: (id: string) => void;
|
|
21
|
+
}
|
|
22
|
+
declare const TabSelectionContext: _$react.Context<TabSelectionContextValue | null>;
|
|
23
|
+
declare function useTabSelectionContext(): TabSelectionContextValue;
|
|
24
|
+
declare function useTabSelectionState({
|
|
25
|
+
defaultSelectedId,
|
|
26
|
+
selectedId: selectedIdProp,
|
|
27
|
+
onSelectionChange
|
|
28
|
+
}: {
|
|
29
|
+
defaultSelectedId?: string;
|
|
30
|
+
selectedId?: string | null;
|
|
31
|
+
onSelectionChange?: (selectedId: string | null | undefined) => void;
|
|
32
|
+
}): TabSelectionContextValue;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { TabSelectionContext, TabSelectionContextValue, TabsVisualContext, TabsVisualContextValue, useTabSelectionContext, useTabSelectionState, useTabsVisualContext };
|
|
35
|
+
//# sourceMappingURL=tabsContexts.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabsContexts.d.cts","names":[],"sources":["../../../src/components/Tabs/tabsContexts.tsx"],"mappings":";;;;;;UAIiB,sBAAA;EACf,OAAA,EAAS,oBAAA;EACT,YAAA;AAAA;AAAA,cAGW,iBAAA,EAAiB,OAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,iBAKd,oBAAA,CAAA,GAAwB,sBAAA;AAAA,UAIvB,wBAAA;EACf,UAAA;EACA,aAAA,GAAgB,EAAA;EAChB,WAAA,GAAc,EAAA;EACd,aAAA,GAAgB,EAAA;EAChB,UAAA,EAAY,WAAA,SAAoB,eAAA;EAChC,YAAA,GAAe,EAAA,UAAY,MAAA,EAAQ,eAAA;EACnC,cAAA,GAAiB,EAAA;AAAA;AAAA,cAGN,mBAAA,EAAmB,OAAA,CAAA,OAAA,CAAA,wBAAA;AAAA,iBAEhB,sBAAA,CAAA,GAA0B,wBAAA;AAAA,iBAQ1B,oBAAA,CAAA;EACd,iBAAA;EACA,UAAA,EAAY,cAAA;EACZ;AAAA;EAEA,iBAAA;EACA,UAAA;EACA,iBAAA,IAAqB,UAAA;AAAA,IACnB,wBAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTabsVariant } from "../../types/dist/index.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
import { LayoutRectangle } from "react-native";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Tabs/tabsContexts.d.ts
|
|
7
|
+
interface TabsVisualContextValue {
|
|
8
|
+
variant: UniversalTabsVariant;
|
|
9
|
+
reduceMotion: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const TabsVisualContext: _$react.Context<TabsVisualContextValue>;
|
|
12
|
+
declare function useTabsVisualContext(): TabsVisualContextValue;
|
|
13
|
+
interface TabSelectionContextValue {
|
|
14
|
+
selectedId: string | null | undefined;
|
|
15
|
+
setSelectedId: (id: string) => void;
|
|
16
|
+
registerTab: (id: string) => void;
|
|
17
|
+
unregisterTab: (id: string) => void;
|
|
18
|
+
tabLayouts: ReadonlyMap<string, LayoutRectangle>;
|
|
19
|
+
setTabLayout: (id: string, layout: LayoutRectangle) => void;
|
|
20
|
+
clearTabLayout: (id: string) => void;
|
|
21
|
+
}
|
|
22
|
+
declare const TabSelectionContext: _$react.Context<TabSelectionContextValue | null>;
|
|
23
|
+
declare function useTabSelectionContext(): TabSelectionContextValue;
|
|
24
|
+
declare function useTabSelectionState({
|
|
25
|
+
defaultSelectedId,
|
|
26
|
+
selectedId: selectedIdProp,
|
|
27
|
+
onSelectionChange
|
|
28
|
+
}: {
|
|
29
|
+
defaultSelectedId?: string;
|
|
30
|
+
selectedId?: string | null;
|
|
31
|
+
onSelectionChange?: (selectedId: string | null | undefined) => void;
|
|
32
|
+
}): TabSelectionContextValue;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { TabSelectionContext, TabSelectionContextValue, TabsVisualContext, TabsVisualContextValue, useTabSelectionContext, useTabSelectionState, useTabsVisualContext };
|
|
35
|
+
//# sourceMappingURL=tabsContexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabsContexts.d.ts","names":[],"sources":["../../../src/components/Tabs/tabsContexts.tsx"],"mappings":";;;;;;UAIiB,sBAAA;EACf,OAAA,EAAS,oBAAA;EACT,YAAA;AAAA;AAAA,cAGW,iBAAA,EAAiB,OAAA,CAAA,OAAA,CAAA,sBAAA;AAAA,iBAKd,oBAAA,CAAA,GAAwB,sBAAA;AAAA,UAIvB,wBAAA;EACf,UAAA;EACA,aAAA,GAAgB,EAAA;EAChB,WAAA,GAAc,EAAA;EACd,aAAA,GAAgB,EAAA;EAChB,UAAA,EAAY,WAAA,SAAoB,eAAA;EAChC,YAAA,GAAe,EAAA,UAAY,MAAA,EAAQ,eAAA;EACnC,cAAA,GAAiB,EAAA;AAAA;AAAA,cAGN,mBAAA,EAAmB,OAAA,CAAA,OAAA,CAAA,wBAAA;AAAA,iBAEhB,sBAAA,CAAA,GAA0B,wBAAA;AAAA,iBAQ1B,oBAAA,CAAA;EACd,iBAAA;EACA,UAAA,EAAY,cAAA;EACZ;AAAA;EAEA,iBAAA;EACA,UAAA;EACA,iBAAA,IAAqB,UAAA;AAAA,IACnB,wBAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
3
|
+
//#region src/components/Tabs/tabsContexts.tsx
|
|
4
|
+
const TabsVisualContext = createContext({
|
|
5
|
+
variant: "primary",
|
|
6
|
+
reduceMotion: false
|
|
7
|
+
});
|
|
8
|
+
function useTabsVisualContext() {
|
|
9
|
+
return useContext(TabsVisualContext);
|
|
10
|
+
}
|
|
11
|
+
const TabSelectionContext = createContext(null);
|
|
12
|
+
function useTabSelectionContext() {
|
|
13
|
+
const ctx = useContext(TabSelectionContext);
|
|
14
|
+
if (!ctx) throw new Error("Tab components must be used within <Tabs>");
|
|
15
|
+
return ctx;
|
|
16
|
+
}
|
|
17
|
+
function useTabSelectionState({ defaultSelectedId, selectedId: selectedIdProp, onSelectionChange }) {
|
|
18
|
+
const isControlled = selectedIdProp !== void 0;
|
|
19
|
+
const [internalSelectedId, setInternalSelectedId] = useState(defaultSelectedId ?? null);
|
|
20
|
+
const [registeredIds, setRegisteredIds] = useState([]);
|
|
21
|
+
const [tabLayouts, setTabLayouts] = useState(() => /* @__PURE__ */ new Map());
|
|
22
|
+
const selectedId = isControlled ? selectedIdProp : internalSelectedId;
|
|
23
|
+
const setSelectedId = useCallback((id) => {
|
|
24
|
+
if (!isControlled) setInternalSelectedId(id);
|
|
25
|
+
onSelectionChange?.(id);
|
|
26
|
+
}, [isControlled, onSelectionChange]);
|
|
27
|
+
const registerTab = useCallback((id) => {
|
|
28
|
+
setRegisteredIds((prev) => prev.includes(id) ? prev : [...prev, id]);
|
|
29
|
+
}, []);
|
|
30
|
+
const unregisterTab = useCallback((id) => {
|
|
31
|
+
setRegisteredIds((prev) => prev.filter((x) => x !== id));
|
|
32
|
+
setTabLayouts((prev) => {
|
|
33
|
+
const next = new Map(prev);
|
|
34
|
+
next.delete(id);
|
|
35
|
+
return next;
|
|
36
|
+
});
|
|
37
|
+
}, []);
|
|
38
|
+
const setTabLayout = useCallback((id, layout) => {
|
|
39
|
+
setTabLayouts((prev) => {
|
|
40
|
+
const cur = prev.get(id);
|
|
41
|
+
if (cur && cur.x === layout.x && cur.y === layout.y && cur.width === layout.width && cur.height === layout.height) return prev;
|
|
42
|
+
const next = new Map(prev);
|
|
43
|
+
next.set(id, layout);
|
|
44
|
+
return next;
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
const clearTabLayout = useCallback((id) => {
|
|
48
|
+
setTabLayouts((prev) => {
|
|
49
|
+
if (!prev.has(id)) return prev;
|
|
50
|
+
const next = new Map(prev);
|
|
51
|
+
next.delete(id);
|
|
52
|
+
return next;
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (isControlled || defaultSelectedId !== void 0) return;
|
|
57
|
+
if (internalSelectedId !== null) return;
|
|
58
|
+
if (registeredIds.length === 0) return;
|
|
59
|
+
setInternalSelectedId(registeredIds[0]);
|
|
60
|
+
}, [
|
|
61
|
+
isControlled,
|
|
62
|
+
defaultSelectedId,
|
|
63
|
+
internalSelectedId,
|
|
64
|
+
registeredIds
|
|
65
|
+
]);
|
|
66
|
+
return useMemo(() => ({
|
|
67
|
+
selectedId,
|
|
68
|
+
setSelectedId,
|
|
69
|
+
registerTab,
|
|
70
|
+
unregisterTab,
|
|
71
|
+
tabLayouts,
|
|
72
|
+
setTabLayout,
|
|
73
|
+
clearTabLayout
|
|
74
|
+
}), [
|
|
75
|
+
selectedId,
|
|
76
|
+
setSelectedId,
|
|
77
|
+
registerTab,
|
|
78
|
+
unregisterTab,
|
|
79
|
+
tabLayouts,
|
|
80
|
+
setTabLayout,
|
|
81
|
+
clearTabLayout
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { TabSelectionContext, TabsVisualContext, useTabSelectionContext, useTabSelectionState, useTabsVisualContext };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=tabsContexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabsContexts.js","names":[],"sources":["../../../src/components/Tabs/tabsContexts.tsx"],"sourcesContent":["import type { UniversalTabsVariant } from '@yahoo/uds-types';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport type { LayoutRectangle } from 'react-native';\n\nexport interface TabsVisualContextValue {\n variant: UniversalTabsVariant;\n reduceMotion: boolean;\n}\n\nexport const TabsVisualContext = createContext<TabsVisualContextValue>({\n variant: 'primary',\n reduceMotion: false,\n});\n\nexport function useTabsVisualContext(): TabsVisualContextValue {\n return useContext(TabsVisualContext);\n}\n\nexport interface TabSelectionContextValue {\n selectedId: string | null | undefined;\n setSelectedId: (id: string) => void;\n registerTab: (id: string) => void;\n unregisterTab: (id: string) => void;\n tabLayouts: ReadonlyMap<string, LayoutRectangle>;\n setTabLayout: (id: string, layout: LayoutRectangle) => void;\n clearTabLayout: (id: string) => void;\n}\n\nexport const TabSelectionContext = createContext<TabSelectionContextValue | null>(null);\n\nexport function useTabSelectionContext(): TabSelectionContextValue {\n const ctx = useContext(TabSelectionContext);\n if (!ctx) {\n throw new Error('Tab components must be used within <Tabs>');\n }\n return ctx;\n}\n\nexport function useTabSelectionState({\n defaultSelectedId,\n selectedId: selectedIdProp,\n onSelectionChange,\n}: {\n defaultSelectedId?: string;\n selectedId?: string | null;\n onSelectionChange?: (selectedId: string | null | undefined) => void;\n}): TabSelectionContextValue {\n const isControlled = selectedIdProp !== undefined;\n const [internalSelectedId, setInternalSelectedId] = useState<string | null>(\n defaultSelectedId ?? null,\n );\n const [registeredIds, setRegisteredIds] = useState<string[]>([]);\n const [tabLayouts, setTabLayouts] = useState<Map<string, LayoutRectangle>>(() => new Map());\n\n const selectedId = isControlled ? selectedIdProp : internalSelectedId;\n\n const setSelectedId = useCallback(\n (id: string) => {\n if (!isControlled) {\n setInternalSelectedId(id);\n }\n onSelectionChange?.(id);\n },\n [isControlled, onSelectionChange],\n );\n\n const registerTab = useCallback((id: string) => {\n setRegisteredIds((prev) => (prev.includes(id) ? prev : [...prev, id]));\n }, []);\n\n const unregisterTab = useCallback((id: string) => {\n setRegisteredIds((prev) => prev.filter((x) => x !== id));\n setTabLayouts((prev) => {\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const setTabLayout = useCallback((id: string, layout: LayoutRectangle) => {\n setTabLayouts((prev) => {\n const cur = prev.get(id);\n if (\n cur &&\n cur.x === layout.x &&\n cur.y === layout.y &&\n cur.width === layout.width &&\n cur.height === layout.height\n ) {\n return prev;\n }\n const next = new Map(prev);\n next.set(id, layout);\n return next;\n });\n }, []);\n\n const clearTabLayout = useCallback((id: string) => {\n setTabLayouts((prev) => {\n if (!prev.has(id)) {\n return prev;\n }\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n useEffect(() => {\n if (isControlled || defaultSelectedId !== undefined) {\n return;\n }\n if (internalSelectedId !== null) {\n return;\n }\n if (registeredIds.length === 0) {\n return;\n }\n setInternalSelectedId(registeredIds[0]!);\n }, [isControlled, defaultSelectedId, internalSelectedId, registeredIds]);\n\n return useMemo(\n () => ({\n selectedId,\n setSelectedId,\n registerTab,\n unregisterTab,\n tabLayouts,\n setTabLayout,\n clearTabLayout,\n }),\n [\n selectedId,\n setSelectedId,\n registerTab,\n unregisterTab,\n tabLayouts,\n setTabLayout,\n clearTabLayout,\n ],\n );\n}\n"],"mappings":";;;AASA,MAAa,oBAAoB,cAAsC;CACrE,SAAS;CACT,cAAc;CACf,CAAC;AAEF,SAAgB,uBAA+C;AAC7D,QAAO,WAAW,kBAAkB;;AAatC,MAAa,sBAAsB,cAA+C,KAAK;AAEvF,SAAgB,yBAAmD;CACjE,MAAM,MAAM,WAAW,oBAAoB;AAC3C,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,4CAA4C;AAE9D,QAAO;;AAGT,SAAgB,qBAAqB,EACnC,mBACA,YAAY,gBACZ,qBAK2B;CAC3B,MAAM,eAAe,mBAAmB,KAAA;CACxC,MAAM,CAAC,oBAAoB,yBAAyB,SAClD,qBAAqB,KACtB;CACD,MAAM,CAAC,eAAe,oBAAoB,SAAmB,EAAE,CAAC;CAChE,MAAM,CAAC,YAAY,iBAAiB,+BAA6C,IAAI,KAAK,CAAC;CAE3F,MAAM,aAAa,eAAe,iBAAiB;CAEnD,MAAM,gBAAgB,aACnB,OAAe;AACd,MAAI,CAAC,aACH,uBAAsB,GAAG;AAE3B,sBAAoB,GAAG;IAEzB,CAAC,cAAc,kBAAkB,CAClC;CAED,MAAM,cAAc,aAAa,OAAe;AAC9C,oBAAkB,SAAU,KAAK,SAAS,GAAG,GAAG,OAAO,CAAC,GAAG,MAAM,GAAG,CAAE;IACrE,EAAE,CAAC;CAEN,MAAM,gBAAgB,aAAa,OAAe;AAChD,oBAAkB,SAAS,KAAK,QAAQ,MAAM,MAAM,GAAG,CAAC;AACxD,iBAAe,SAAS;GACtB,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,QAAK,OAAO,GAAG;AACf,UAAO;IACP;IACD,EAAE,CAAC;CAEN,MAAM,eAAe,aAAa,IAAY,WAA4B;AACxE,iBAAe,SAAS;GACtB,MAAM,MAAM,KAAK,IAAI,GAAG;AACxB,OACE,OACA,IAAI,MAAM,OAAO,KACjB,IAAI,MAAM,OAAO,KACjB,IAAI,UAAU,OAAO,SACrB,IAAI,WAAW,OAAO,OAEtB,QAAO;GAET,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,QAAK,IAAI,IAAI,OAAO;AACpB,UAAO;IACP;IACD,EAAE,CAAC;CAEN,MAAM,iBAAiB,aAAa,OAAe;AACjD,iBAAe,SAAS;AACtB,OAAI,CAAC,KAAK,IAAI,GAAG,CACf,QAAO;GAET,MAAM,OAAO,IAAI,IAAI,KAAK;AAC1B,QAAK,OAAO,GAAG;AACf,UAAO;IACP;IACD,EAAE,CAAC;AAEN,iBAAgB;AACd,MAAI,gBAAgB,sBAAsB,KAAA,EACxC;AAEF,MAAI,uBAAuB,KACzB;AAEF,MAAI,cAAc,WAAW,EAC3B;AAEF,wBAAsB,cAAc,GAAI;IACvC;EAAC;EAAc;EAAmB;EAAoB;EAAc,CAAC;AAExE,QAAO,eACE;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF"}
|
|
@@ -13,6 +13,7 @@ var styles_exports = /* @__PURE__ */ require("../../_virtual/_rolldown/runtime.c
|
|
|
13
13
|
radioStyles: () => radioStyles,
|
|
14
14
|
styles: () => styles,
|
|
15
15
|
switchStyles: () => switchStyles,
|
|
16
|
+
tabsStyles: () => tabsStyles,
|
|
16
17
|
textStyles: () => textStyles
|
|
17
18
|
});
|
|
18
19
|
/**
|
|
@@ -303,6 +304,11 @@ const iconButtonStyles = createComponentStyles({
|
|
|
303
304
|
color: "#000000"
|
|
304
305
|
}
|
|
305
306
|
});
|
|
307
|
+
const tabsStyles = createComponentStyles({ root: {
|
|
308
|
+
flexDirection: "row",
|
|
309
|
+
alignItems: "center",
|
|
310
|
+
gap: 8
|
|
311
|
+
} });
|
|
306
312
|
//#endregion
|
|
307
313
|
exports.avatarStyles = avatarStyles;
|
|
308
314
|
exports.badgeStyles = badgeStyles;
|
|
@@ -321,4 +327,5 @@ Object.defineProperty(exports, "styles_exports", {
|
|
|
321
327
|
}
|
|
322
328
|
});
|
|
323
329
|
exports.switchStyles = switchStyles;
|
|
330
|
+
exports.tabsStyles = tabsStyles;
|
|
324
331
|
exports.textStyles = textStyles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
declare namespace styles_d_exports {
|
|
3
|
-
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, switchStyles, textStyles };
|
|
3
|
+
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, switchStyles, tabsStyles, textStyles };
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Jest mock for generated/styles.
|
|
@@ -20,6 +20,7 @@ declare const chipStyles: Record<string, unknown>;
|
|
|
20
20
|
declare const linkStyles: Record<string, unknown>;
|
|
21
21
|
declare const radioStyles: Record<string, unknown>;
|
|
22
22
|
declare const iconButtonStyles: Record<string, unknown>;
|
|
23
|
+
declare const tabsStyles: Record<string, unknown>;
|
|
23
24
|
interface StyleProps {
|
|
24
25
|
color?: string;
|
|
25
26
|
backgroundColor?: string;
|
|
@@ -29,5 +30,5 @@ interface StyleProps {
|
|
|
29
30
|
[key: string]: unknown;
|
|
30
31
|
}
|
|
31
32
|
//#endregion
|
|
32
|
-
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, styles_d_exports, switchStyles, textStyles };
|
|
33
|
+
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, styles_d_exports, switchStyles, tabsStyles, textStyles };
|
|
33
34
|
//# sourceMappingURL=styles.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.cts","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"mappings":";;;;;;;;;;cAyGa,MAAA,EAAM,MAAA;AAAA,cAKN,YAAA,EAAY,MAAA;AAAA,cAgCZ,UAAA,EAAU,MAAA;AAAA,cAUV,WAAA,EAAW,MAAA;AAAA,cAuCX,cAAA,EAAc,MAAA;AAAA,cAwBd,YAAA,EAAY,MAAA;AAAA,cA4BZ,YAAA,EAAY,MAAA;AAAA,cAqBZ,WAAA,EAAW,MAAA;AAAA,cAmBX,UAAA,EAAU,MAAA;AAAA,cAsBV,UAAA,EAAU,MAAA;AAAA,cAgBV,WAAA,EAAW,MAAA;AAAA,cA8BX,gBAAA,EAAgB,MAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"styles.d.cts","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"mappings":";;;;;;;;;;cAyGa,MAAA,EAAM,MAAA;AAAA,cAKN,YAAA,EAAY,MAAA;AAAA,cAgCZ,UAAA,EAAU,MAAA;AAAA,cAUV,WAAA,EAAW,MAAA;AAAA,cAuCX,cAAA,EAAc,MAAA;AAAA,cAwBd,YAAA,EAAY,MAAA;AAAA,cA4BZ,YAAA,EAAY,MAAA;AAAA,cAqBZ,WAAA,EAAW,MAAA;AAAA,cAmBX,UAAA,EAAU,MAAA;AAAA,cAsBV,UAAA,EAAU,MAAA;AAAA,cAgBV,WAAA,EAAW,MAAA;AAAA,cA8BX,gBAAA,EAAgB,MAAA;AAAA,cAehB,UAAA,EAAU,MAAA;AAAA,UASN,UAAA;EACf,KAAA;EACA,eAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EAAA,CACC,GAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
declare namespace styles_d_exports {
|
|
3
|
-
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, switchStyles, textStyles };
|
|
3
|
+
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, switchStyles, tabsStyles, textStyles };
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* Jest mock for generated/styles.
|
|
@@ -20,6 +20,7 @@ declare const chipStyles: Record<string, unknown>;
|
|
|
20
20
|
declare const linkStyles: Record<string, unknown>;
|
|
21
21
|
declare const radioStyles: Record<string, unknown>;
|
|
22
22
|
declare const iconButtonStyles: Record<string, unknown>;
|
|
23
|
+
declare const tabsStyles: Record<string, unknown>;
|
|
23
24
|
interface StyleProps {
|
|
24
25
|
color?: string;
|
|
25
26
|
backgroundColor?: string;
|
|
@@ -29,5 +30,5 @@ interface StyleProps {
|
|
|
29
30
|
[key: string]: unknown;
|
|
30
31
|
}
|
|
31
32
|
//#endregion
|
|
32
|
-
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, styles_d_exports, switchStyles, textStyles };
|
|
33
|
+
export { StyleProps, avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, styles_d_exports, switchStyles, tabsStyles, textStyles };
|
|
33
34
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"mappings":";;;;;;;;;;cAyGa,MAAA,EAAM,MAAA;AAAA,cAKN,YAAA,EAAY,MAAA;AAAA,cAgCZ,UAAA,EAAU,MAAA;AAAA,cAUV,WAAA,EAAW,MAAA;AAAA,cAuCX,cAAA,EAAc,MAAA;AAAA,cAwBd,YAAA,EAAY,MAAA;AAAA,cA4BZ,YAAA,EAAY,MAAA;AAAA,cAqBZ,WAAA,EAAW,MAAA;AAAA,cAmBX,UAAA,EAAU,MAAA;AAAA,cAsBV,UAAA,EAAU,MAAA;AAAA,cAgBV,WAAA,EAAW,MAAA;AAAA,cA8BX,gBAAA,EAAgB,MAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"mappings":";;;;;;;;;;cAyGa,MAAA,EAAM,MAAA;AAAA,cAKN,YAAA,EAAY,MAAA;AAAA,cAgCZ,UAAA,EAAU,MAAA;AAAA,cAUV,WAAA,EAAW,MAAA;AAAA,cAuCX,cAAA,EAAc,MAAA;AAAA,cAwBd,YAAA,EAAY,MAAA;AAAA,cA4BZ,YAAA,EAAY,MAAA;AAAA,cAqBZ,WAAA,EAAW,MAAA;AAAA,cAmBX,UAAA,EAAU,MAAA;AAAA,cAsBV,UAAA,EAAU,MAAA;AAAA,cAgBV,WAAA,EAAW,MAAA;AAAA,cA8BX,gBAAA,EAAgB,MAAA;AAAA,cAehB,UAAA,EAAU,MAAA;AAAA,UASN,UAAA;EACf,KAAA;EACA,eAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EAAA,CACC,GAAA;AAAA"}
|
|
@@ -13,6 +13,7 @@ var styles_exports = /* @__PURE__ */ __exportAll({
|
|
|
13
13
|
radioStyles: () => radioStyles,
|
|
14
14
|
styles: () => styles,
|
|
15
15
|
switchStyles: () => switchStyles,
|
|
16
|
+
tabsStyles: () => tabsStyles,
|
|
16
17
|
textStyles: () => textStyles
|
|
17
18
|
});
|
|
18
19
|
/**
|
|
@@ -303,7 +304,12 @@ const iconButtonStyles = createComponentStyles({
|
|
|
303
304
|
color: "#000000"
|
|
304
305
|
}
|
|
305
306
|
});
|
|
307
|
+
const tabsStyles = createComponentStyles({ root: {
|
|
308
|
+
flexDirection: "row",
|
|
309
|
+
alignItems: "center",
|
|
310
|
+
gap: 8
|
|
311
|
+
} });
|
|
306
312
|
//#endregion
|
|
307
|
-
export { avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, styles_exports, switchStyles, textStyles };
|
|
313
|
+
export { avatarStyles, badgeStyles, buttonStyles, checkboxStyles, chipStyles, iconButtonStyles, inputStyles, linkStyles, radioStyles, styles, styles_exports, switchStyles, tabsStyles, textStyles };
|
|
308
314
|
|
|
309
315
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"sourcesContent":["/**\n * Jest mock for generated/styles.\n *\n * Provides proxy-based mocks for the generated style objects\n * (styles, buttonStyles, etc.) with useVariants as a no-op.\n */\n\n/// <reference types=\"jest\" />\n\n// Default style values for foundation\nconst defaultFoundation = {\n // Layout\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'stretch',\n justifyContent: 'flex-start',\n // Spacing\n padding: 0,\n paddingHorizontal: 0,\n paddingVertical: 0,\n margin: 0,\n gap: 0,\n // Colors\n backgroundColor: 'transparent',\n color: '#000000',\n borderColor: 'transparent',\n // Border\n borderWidth: 0,\n borderRadius: 0,\n // Typography\n fontFamily: 'System',\n fontSize: 14,\n lineHeight: 20,\n fontWeight: 'regular',\n // Effects\n opacity: 1,\n boxShadow: '',\n};\n\n// Create a style object with useVariants attached\nfunction createStyleObject(baseStyles: Record<string, unknown> = {}) {\n const proxy = new Proxy(\n { ...defaultFoundation, ...baseStyles, useVariants: jest.fn() },\n {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return sensible defaults for unknown properties\n if (typeof prop === 'string') {\n if (prop.includes('color') || prop.includes('Color')) {\n return '#000000';\n }\n if (prop.includes('width') || prop.includes('Width')) {\n return 0;\n }\n if (prop.includes('radius') || prop.includes('Radius')) {\n return 0;\n }\n if (prop.includes('size') || prop.includes('Size')) {\n return 16;\n }\n if (prop.includes('spacing') || prop.includes('Spacing')) {\n return 0;\n }\n if (prop.includes('gap') || prop.includes('Gap')) {\n return 0;\n }\n }\n return undefined;\n },\n },\n );\n return proxy;\n}\n\n// Create a component style object (like buttonStyles) with multiple style keys\nfunction createComponentStyles(styleKeys: Record<string, Record<string, unknown>>) {\n const result: Record<string, unknown> = { useVariants: jest.fn() };\n\n for (const [key, baseStyles] of Object.entries(styleKeys)) {\n result[key] = createStyleObject(baseStyles);\n }\n\n return new Proxy(result, {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return a default style object for any unknown key\n if (typeof prop === 'string') {\n return createStyleObject();\n }\n return undefined;\n },\n });\n}\n\n// Main styles export\nexport const styles = createComponentStyles({\n foundation: defaultFoundation,\n});\n\n// Button styles\nexport const buttonStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n paddingHorizontal: 16,\n paddingVertical: 10,\n backgroundColor: '#6001D2',\n borderRadius: 8,\n borderWidth: 0,\n borderColor: 'transparent',\n opacity: 1,\n boxShadow: '',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n letterSpacing: 0,\n lineHeight: 20,\n color: '#FFFFFF',\n },\n icon: {\n fontSize: 16,\n iconSizeToken: 'sm',\n lineHeight: 16,\n color: '#FFFFFF',\n },\n});\n\n// Text styles\nexport const textStyles = createComponentStyles({\n root: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Input styles\nexport const inputStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n },\n label: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n inputContainer: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 10,\n backgroundColor: '#FFFFFF',\n borderRadius: 8,\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n input: {\n flex: 1,\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 16,\n lineHeight: 24,\n color: '#000000',\n },\n helperText: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 12,\n lineHeight: 16,\n color: '#666666',\n },\n});\n\n// Checkbox styles\nexport const checkboxStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n box: {\n width: 20,\n height: 20,\n borderRadius: 4,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Switch styles\nexport const switchStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n track: {\n width: 48,\n height: 28,\n borderRadius: 14,\n backgroundColor: '#E0E0E0',\n },\n thumb: {\n width: 24,\n height: 24,\n borderRadius: 12,\n backgroundColor: '#FFFFFF',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Avatar styles\nexport const avatarStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 9999,\n backgroundColor: '#E0E0E0',\n overflow: 'hidden',\n },\n image: {\n width: '100%',\n height: '100%',\n },\n initials: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n color: '#000000',\n },\n});\n\n// Badge styles\nexport const badgeStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 8,\n paddingVertical: 2,\n borderRadius: 4,\n backgroundColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 12,\n lineHeight: 16,\n color: '#000000',\n },\n});\n\n// Chip styles\nexport const chipStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n paddingHorizontal: 12,\n paddingVertical: 6,\n borderRadius: 16,\n backgroundColor: '#F5F5F5',\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Link styles\nexport const linkStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n text: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#6001D2',\n textDecorationLine: 'underline',\n },\n});\n\n// Radio styles\nexport const radioStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n circle: {\n width: 20,\n height: 20,\n borderRadius: 10,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n dot: {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: '#6001D2',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// IconButton styles\nexport const iconButtonStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 8,\n backgroundColor: 'transparent',\n },\n icon: {\n fontSize: 24,\n color: '#000000',\n },\n});\n\n// Type for StyleProps\nexport interface StyleProps {\n color?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: number;\n borderRadius?: number;\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB;CAExB,SAAS;CACT,eAAe;CACf,YAAY;CACZ,gBAAgB;CAEhB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;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AAc;EACd,iBAAiB;EAClB;CACD,OAAO;EACL,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,OAAO;EACR;CACF,CAAC;AAGF,MAAa,mBAAmB,sBAAsB;CACpD,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,cAAc;EACd,iBAAiB;EAClB;CACD,MAAM;EACJ,UAAU;EACV,OAAO;EACR;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"styles.js","names":[],"sources":["../../../src/jest/mocks/styles.ts"],"sourcesContent":["/**\n * Jest mock for generated/styles.\n *\n * Provides proxy-based mocks for the generated style objects\n * (styles, buttonStyles, etc.) with useVariants as a no-op.\n */\n\n/// <reference types=\"jest\" />\n\n// Default style values for foundation\nconst defaultFoundation = {\n // Layout\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'stretch',\n justifyContent: 'flex-start',\n // Spacing\n padding: 0,\n paddingHorizontal: 0,\n paddingVertical: 0,\n margin: 0,\n gap: 0,\n // Colors\n backgroundColor: 'transparent',\n color: '#000000',\n borderColor: 'transparent',\n // Border\n borderWidth: 0,\n borderRadius: 0,\n // Typography\n fontFamily: 'System',\n fontSize: 14,\n lineHeight: 20,\n fontWeight: 'regular',\n // Effects\n opacity: 1,\n boxShadow: '',\n};\n\n// Create a style object with useVariants attached\nfunction createStyleObject(baseStyles: Record<string, unknown> = {}) {\n const proxy = new Proxy(\n { ...defaultFoundation, ...baseStyles, useVariants: jest.fn() },\n {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return sensible defaults for unknown properties\n if (typeof prop === 'string') {\n if (prop.includes('color') || prop.includes('Color')) {\n return '#000000';\n }\n if (prop.includes('width') || prop.includes('Width')) {\n return 0;\n }\n if (prop.includes('radius') || prop.includes('Radius')) {\n return 0;\n }\n if (prop.includes('size') || prop.includes('Size')) {\n return 16;\n }\n if (prop.includes('spacing') || prop.includes('Spacing')) {\n return 0;\n }\n if (prop.includes('gap') || prop.includes('Gap')) {\n return 0;\n }\n }\n return undefined;\n },\n },\n );\n return proxy;\n}\n\n// Create a component style object (like buttonStyles) with multiple style keys\nfunction createComponentStyles(styleKeys: Record<string, Record<string, unknown>>) {\n const result: Record<string, unknown> = { useVariants: jest.fn() };\n\n for (const [key, baseStyles] of Object.entries(styleKeys)) {\n result[key] = createStyleObject(baseStyles);\n }\n\n return new Proxy(result, {\n get(target, prop) {\n if (prop === 'useVariants') {\n return jest.fn();\n }\n if (prop in target) {\n return target[prop as keyof typeof target];\n }\n // Return a default style object for any unknown key\n if (typeof prop === 'string') {\n return createStyleObject();\n }\n return undefined;\n },\n });\n}\n\n// Main styles export\nexport const styles = createComponentStyles({\n foundation: defaultFoundation,\n});\n\n// Button styles\nexport const buttonStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n paddingHorizontal: 16,\n paddingVertical: 10,\n backgroundColor: '#6001D2',\n borderRadius: 8,\n borderWidth: 0,\n borderColor: 'transparent',\n opacity: 1,\n boxShadow: '',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n letterSpacing: 0,\n lineHeight: 20,\n color: '#FFFFFF',\n },\n icon: {\n fontSize: 16,\n iconSizeToken: 'sm',\n lineHeight: 16,\n color: '#FFFFFF',\n },\n});\n\n// Text styles\nexport const textStyles = createComponentStyles({\n root: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Input styles\nexport const inputStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n },\n label: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n inputContainer: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 10,\n backgroundColor: '#FFFFFF',\n borderRadius: 8,\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n input: {\n flex: 1,\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 16,\n lineHeight: 24,\n color: '#000000',\n },\n helperText: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 12,\n lineHeight: 16,\n color: '#666666',\n },\n});\n\n// Checkbox styles\nexport const checkboxStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n box: {\n width: 20,\n height: 20,\n borderRadius: 4,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Switch styles\nexport const switchStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n track: {\n width: 48,\n height: 28,\n borderRadius: 14,\n backgroundColor: '#E0E0E0',\n },\n thumb: {\n width: 24,\n height: 24,\n borderRadius: 12,\n backgroundColor: '#FFFFFF',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Avatar styles\nexport const avatarStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 9999,\n backgroundColor: '#E0E0E0',\n overflow: 'hidden',\n },\n image: {\n width: '100%',\n height: '100%',\n },\n initials: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n color: '#000000',\n },\n});\n\n// Badge styles\nexport const badgeStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: 8,\n paddingVertical: 2,\n borderRadius: 4,\n backgroundColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 12,\n lineHeight: 16,\n color: '#000000',\n },\n});\n\n// Chip styles\nexport const chipStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n paddingHorizontal: 12,\n paddingVertical: 6,\n borderRadius: 16,\n backgroundColor: '#F5F5F5',\n borderWidth: 1,\n borderColor: '#E0E0E0',\n },\n text: {\n fontFamily: 'YahooProductSans-Medium',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// Link styles\nexport const linkStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n text: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#6001D2',\n textDecorationLine: 'underline',\n },\n});\n\n// Radio styles\nexport const radioStyles = createComponentStyles({\n root: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n circle: {\n width: 20,\n height: 20,\n borderRadius: 10,\n borderWidth: 2,\n borderColor: '#6001D2',\n backgroundColor: 'transparent',\n },\n dot: {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: '#6001D2',\n },\n label: {\n fontFamily: 'YahooProductSans-Regular',\n fontSize: 14,\n lineHeight: 20,\n color: '#000000',\n },\n});\n\n// IconButton styles\nexport const iconButtonStyles = createComponentStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 8,\n backgroundColor: 'transparent',\n },\n icon: {\n fontSize: 24,\n color: '#000000',\n },\n});\n\n// Tabs (tab list chrome)\nexport const tabsStyles = createComponentStyles({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n});\n\n// Type for StyleProps\nexport interface StyleProps {\n color?: string;\n backgroundColor?: string;\n borderColor?: string;\n borderWidth?: number;\n borderRadius?: number;\n [key: string]: unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,oBAAoB;CAExB,SAAS;CACT,eAAe;CACf,YAAY;CACZ,gBAAgB;CAEhB,SAAS;CACT,mBAAmB;C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QAAQ;EACR,cAAc;EACd,iBAAiB;EAClB;CACD,OAAO;EACL,YAAY;EACZ,UAAU;EACV,YAAY;EACZ,OAAO;EACR;CACF,CAAC;AAGF,MAAa,mBAAmB,sBAAsB;CACpD,MAAM;EACJ,SAAS;EACT,YAAY;EACZ,gBAAgB;EAChB,cAAc;EACd,iBAAiB;EAClB;CACD,MAAM;EACJ,UAAU;EACV,OAAO;EACR;CACF,CAAC;AAGF,MAAa,aAAa,sBAAsB,EAC9C,MAAM;CACJ,eAAe;CACf,YAAY;CACZ,KAAK;CACN,EACF,CAAC"}
|
|
@@ -311,6 +311,57 @@ interface UniversalBannerProps<IconSlotType = UniversalIconSlot> {
|
|
|
311
311
|
/** Actions (Button, Link) or BannerContent + actions. */
|
|
312
312
|
children?: ReactNode;
|
|
313
313
|
}
|
|
314
|
+
type UniversalTabsVariant = 'primary' | 'secondary';
|
|
315
|
+
interface UniversalTabsProps {
|
|
316
|
+
/** The TabList and TabPanel elements. */
|
|
317
|
+
children: ReactNode;
|
|
318
|
+
/** Visual style variant for the tab list and indicators. @default 'primary' */
|
|
319
|
+
variant?: UniversalTabsVariant;
|
|
320
|
+
/**
|
|
321
|
+
* When true, the sliding selection indicator motion is reduced and selection chrome is
|
|
322
|
+
* applied per tab without sliding motion. When false (default), the underline / pill is a single
|
|
323
|
+
* layer that slides between tabs (240ms, same easing as the design reference). @default false
|
|
324
|
+
*/
|
|
325
|
+
reduceMotion?: boolean;
|
|
326
|
+
/** The id of the tab selected by default (uncontrolled). */
|
|
327
|
+
defaultSelectedId?: string;
|
|
328
|
+
/** The controlled selected tab id. `null` represents no selected tab. */
|
|
329
|
+
selectedId?: string | null;
|
|
330
|
+
/** Callback when the selected tab changes. */
|
|
331
|
+
onSelectionChange?: (selectedId: string | null | undefined) => void;
|
|
332
|
+
}
|
|
333
|
+
interface UniversalTabListProps extends React.AriaAttributes {
|
|
334
|
+
/** Tab items rendered within the list. */
|
|
335
|
+
children: ReactNode;
|
|
336
|
+
/** Enables horizontal scrolling when tabs overflow. */
|
|
337
|
+
scrollable?: boolean;
|
|
338
|
+
/** Optional class name for custom styling. */
|
|
339
|
+
className?: string;
|
|
340
|
+
}
|
|
341
|
+
interface UniversalTabPanelProps {
|
|
342
|
+
/** The id of the associated tab. */
|
|
343
|
+
tabId: string;
|
|
344
|
+
/** Content shown when the associated tab is selected. */
|
|
345
|
+
children: ReactNode;
|
|
346
|
+
/** Optional class name for custom styling. */
|
|
347
|
+
className?: string;
|
|
348
|
+
}
|
|
349
|
+
interface UniversalTabProps {
|
|
350
|
+
/** Unique identifier for this tab, used to connect with a TabPanel. When omitted, one is auto-generated. */
|
|
351
|
+
value?: string;
|
|
352
|
+
/** Tab content, typically a text label. */
|
|
353
|
+
children: ReactNode;
|
|
354
|
+
/** Icon rendered before the label. */
|
|
355
|
+
startIcon?: UniversalIconSlot;
|
|
356
|
+
/** Icon rendered after the label. */
|
|
357
|
+
endIcon?: UniversalIconSlot;
|
|
358
|
+
/** Disables the tab. */
|
|
359
|
+
disabled?: boolean;
|
|
360
|
+
/** Merge props onto the immediate child element instead of rendering a wrapper. */
|
|
361
|
+
asChild?: boolean;
|
|
362
|
+
/** Optional class name for custom styling. */
|
|
363
|
+
className?: string;
|
|
364
|
+
}
|
|
314
365
|
//#endregion
|
|
315
|
-
export { type BadgeSize, type BadgeVariant, type BannerVariant, type ButtonSize, type ButtonVariantFlat, type ChipSize, type ChipVariant, type ElevationLevel, type IconButtonSize, type IconSize, type IconVariant, type MotionConfig, type MotionVariantValues, type UniversalBannerProps, type UniversalCheckboxProps, type UniversalImageProps, type UniversalInputProps, type UniversalLinkProps, type UniversalRadioProps, type UniversalSwitchProps };
|
|
366
|
+
export { type BadgeSize, type BadgeVariant, type BannerVariant, type ButtonSize, type ButtonVariantFlat, type ChipSize, type ChipVariant, type ElevationLevel, type IconButtonSize, type IconSize, type IconVariant, type MotionConfig, type MotionVariantValues, type UniversalBannerProps, type UniversalCheckboxProps, type UniversalImageProps, type UniversalInputProps, type UniversalLinkProps, type UniversalRadioProps, type UniversalSwitchProps, type UniversalTabListProps, type UniversalTabPanelProps, type UniversalTabProps, type UniversalTabsProps, type UniversalTabsVariant };
|
|
316
367
|
//# sourceMappingURL=index.d.cts.map
|