@yahoo/uds 3.165.0 → 3.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/sync.cjs +36 -0
- package/dist/cli/commands/sync.js +36 -0
- package/dist/components/client/Avatar/AvatarIcon.cjs +3 -0
- package/dist/components/client/Avatar/AvatarIcon.js +3 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.cjs +28 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.d.cts +29 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.d.ts +30 -0
- package/dist/components/client/Avatar/UDSAvatarConfigProvider.js +27 -0
- package/dist/components/client/Avatar/index.cjs +3 -0
- package/dist/components/client/Avatar/index.d.cts +2 -1
- package/dist/components/client/Avatar/index.d.ts +2 -1
- package/dist/components/client/Avatar/index.js +2 -1
- package/dist/components/client/Badge.cjs +4 -1
- package/dist/components/client/Badge.js +4 -1
- package/dist/components/client/Chip/ChipBase.cjs +4 -0
- package/dist/components/client/Chip/ChipBase.js +4 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.cjs +28 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.d.cts +29 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.d.ts +30 -0
- package/dist/components/client/Chip/UDSChipConfigProvider.js +27 -0
- package/dist/components/client/Chip/index.cjs +3 -0
- package/dist/components/client/Chip/index.d.cts +2 -1
- package/dist/components/client/Chip/index.d.ts +2 -1
- package/dist/components/client/Chip/index.js +2 -1
- package/dist/components/client/Input/Input.cjs +10 -2
- package/dist/components/client/Input/Input.js +10 -2
- package/dist/components/client/Input/InputHelpTextInternal.cjs +6 -1
- package/dist/components/client/Input/InputHelpTextInternal.js +6 -1
- package/dist/components/client/Input/UDSInputConfigProvider.cjs +33 -0
- package/dist/components/client/Input/UDSInputConfigProvider.d.cts +32 -0
- package/dist/components/client/Input/UDSInputConfigProvider.d.ts +33 -0
- package/dist/components/client/Input/UDSInputConfigProvider.js +32 -0
- package/dist/components/client/Input/index.cjs +3 -0
- package/dist/components/client/Input/index.d.cts +2 -1
- package/dist/components/client/Input/index.d.ts +2 -1
- package/dist/components/client/Input/index.js +2 -1
- package/dist/components/client/Menu/Menu.ItemBase.cjs +4 -2
- package/dist/components/client/Menu/Menu.ItemBase.js +4 -2
- 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/Menu/UDSMenuItemConfigProvider.cjs +30 -0
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.d.cts +29 -0
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.d.ts +30 -0
- package/dist/components/client/Menu/UDSMenuItemConfigProvider.js +29 -0
- package/dist/components/client/Menu/index.cjs +3 -0
- package/dist/components/client/Menu/index.d.cts +2 -1
- package/dist/components/client/Menu/index.d.ts +2 -1
- package/dist/components/client/Menu/index.js +2 -1
- package/dist/components/client/PaddleNav/PaddleButton.cjs +3 -1
- package/dist/components/client/PaddleNav/PaddleButton.js +3 -1
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.cjs +30 -0
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.d.cts +29 -0
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.d.ts +30 -0
- package/dist/components/client/PaddleNav/UDSPaddleNavConfigProvider.js +29 -0
- package/dist/components/client/PaddleNav/index.cjs +3 -0
- package/dist/components/client/PaddleNav/index.d.cts +3 -1
- package/dist/components/client/PaddleNav/index.d.ts +3 -1
- package/dist/components/client/PaddleNav/index.js +2 -1
- package/dist/components/client/Pagination/PaginationNext.cjs +3 -1
- package/dist/components/client/Pagination/PaginationNext.js +3 -1
- package/dist/components/client/Pagination/PaginationPrev.cjs +3 -1
- package/dist/components/client/Pagination/PaginationPrev.js +3 -1
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.cjs +30 -0
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.d.cts +29 -0
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.d.ts +30 -0
- package/dist/components/client/Pagination/UDSPaginationConfigProvider.js +29 -0
- package/dist/components/client/Pagination/index.cjs +3 -0
- package/dist/components/client/Pagination/index.d.cts +2 -1
- package/dist/components/client/Pagination/index.d.ts +2 -1
- package/dist/components/client/Pagination/index.js +2 -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/Select/SelectItem.cjs +4 -2
- package/dist/components/client/Select/SelectItem.js +4 -2
- package/dist/components/client/Select/UDSSelectItemConfigProvider.cjs +30 -0
- package/dist/components/client/Select/UDSSelectItemConfigProvider.d.cts +29 -0
- package/dist/components/client/Select/UDSSelectItemConfigProvider.d.ts +30 -0
- package/dist/components/client/Select/UDSSelectItemConfigProvider.js +29 -0
- package/dist/components/client/Select/index.cjs +3 -0
- package/dist/components/client/Select/index.d.cts +3 -1
- package/dist/components/client/Select/index.d.ts +3 -1
- package/dist/components/client/Select/index.js +2 -1
- package/dist/components/client/Tabs/Tab.cjs +4 -2
- package/dist/components/client/Tabs/Tab.js +4 -2
- package/dist/components/client/Tabs/UDSTabConfigProvider.cjs +22 -0
- package/dist/components/client/Tabs/UDSTabConfigProvider.d.cts +27 -0
- package/dist/components/client/Tabs/UDSTabConfigProvider.d.ts +28 -0
- package/dist/components/client/Tabs/UDSTabConfigProvider.js +21 -0
- package/dist/components/client/Tabs/index.cjs +3 -0
- package/dist/components/client/Tabs/index.d.cts +3 -1
- package/dist/components/client/Tabs/index.d.ts +3 -1
- package/dist/components/client/Tabs/index.js +2 -1
- package/dist/components/client/Tooltip/Tooltip.cjs +3 -2
- package/dist/components/client/Tooltip/Tooltip.d.cts +2 -1
- package/dist/components/client/Tooltip/Tooltip.d.ts +2 -1
- package/dist/components/client/Tooltip/Tooltip.js +3 -2
- package/dist/components/client/Tooltip/TooltipContent.cjs +4 -2
- package/dist/components/client/Tooltip/TooltipContent.js +4 -2
- package/dist/components/client/Tooltip/tooltipContext.d.cts +1 -0
- package/dist/components/client/Tooltip/tooltipContext.d.ts +1 -0
- package/dist/components/client/UDSBadgeConfigProvider.cjs +28 -0
- package/dist/components/client/UDSBadgeConfigProvider.d.cts +29 -0
- package/dist/components/client/UDSBadgeConfigProvider.d.ts +30 -0
- package/dist/components/client/UDSBadgeConfigProvider.js +27 -0
- package/dist/components/client/index.cjs +27 -0
- package/dist/components/client/index.d.cts +10 -1
- package/dist/components/client/index.d.ts +10 -1
- package/dist/components/client/index.js +10 -1
- package/dist/components/client/providers/UDSConfigProvider.cjs +52 -16
- package/dist/components/client/providers/UDSConfigProvider.d.cts +9 -0
- package/dist/components/client/providers/UDSConfigProvider.d.ts +9 -0
- package/dist/components/client/providers/UDSConfigProvider.js +52 -16
- package/dist/components/client/providers/createUDSConfigProvider.cjs +41 -0
- package/dist/components/client/providers/createUDSConfigProvider.d.cts +38 -0
- package/dist/components/client/providers/createUDSConfigProvider.d.ts +39 -0
- package/dist/components/client/providers/createUDSConfigProvider.js +39 -0
- package/dist/components/index.cjs +27 -0
- package/dist/components/index.d.cts +10 -1
- package/dist/components/index.d.ts +10 -1
- package/dist/components/index.js +10 -1
- package/dist/css/dist/css/utils.cjs +58 -0
- package/dist/css/dist/css/utils.js +58 -0
- package/dist/css/dist/runtimeConfig/hookMetadata.cjs +320 -0
- package/dist/css/dist/runtimeConfig/hookMetadata.js +320 -0
- package/dist/index.cjs +45 -0
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +19 -1
- package/dist/runtime/avatarConfig.cjs +21 -0
- package/dist/runtime/avatarConfig.d.cts +13 -0
- package/dist/runtime/avatarConfig.d.ts +13 -0
- package/dist/runtime/avatarConfig.js +20 -0
- package/dist/runtime/badgeConfig.cjs +17 -0
- package/dist/runtime/badgeConfig.d.cts +13 -0
- package/dist/runtime/badgeConfig.d.ts +13 -0
- package/dist/runtime/badgeConfig.js +16 -0
- package/dist/runtime/chipConfig.cjs +12 -0
- package/dist/runtime/chipConfig.d.cts +13 -0
- package/dist/runtime/chipConfig.d.ts +13 -0
- package/dist/runtime/chipConfig.js +11 -0
- package/dist/runtime/index.cjs +18 -0
- package/dist/runtime/index.d.cts +10 -1
- package/dist/runtime/index.d.ts +10 -1
- package/dist/runtime/index.js +10 -1
- package/dist/runtime/inputConfig.cjs +14 -0
- package/dist/runtime/inputConfig.d.cts +15 -0
- package/dist/runtime/inputConfig.d.ts +15 -0
- package/dist/runtime/inputConfig.js +13 -0
- package/dist/runtime/menuItemConfig.cjs +13 -0
- package/dist/runtime/menuItemConfig.d.cts +15 -0
- package/dist/runtime/menuItemConfig.d.ts +15 -0
- package/dist/runtime/menuItemConfig.js +12 -0
- package/dist/runtime/paddleNavConfig.cjs +18 -0
- package/dist/runtime/paddleNavConfig.d.cts +13 -0
- package/dist/runtime/paddleNavConfig.d.ts +13 -0
- package/dist/runtime/paddleNavConfig.js +17 -0
- package/dist/runtime/paginationConfig.cjs +12 -0
- package/dist/runtime/paginationConfig.d.cts +13 -0
- package/dist/runtime/paginationConfig.d.ts +13 -0
- package/dist/runtime/paginationConfig.js +11 -0
- package/dist/runtime/selectItemConfig.cjs +13 -0
- package/dist/runtime/selectItemConfig.d.cts +15 -0
- package/dist/runtime/selectItemConfig.d.ts +15 -0
- package/dist/runtime/selectItemConfig.js +12 -0
- package/dist/runtime/tabConfig.cjs +12 -0
- package/dist/runtime/tabConfig.d.cts +14 -0
- package/dist/runtime/tabConfig.d.ts +14 -0
- package/dist/runtime/tabConfig.js +11 -0
- package/dist/runtime/udsConfig.cjs +18 -0
- package/dist/runtime/udsConfig.d.cts +18 -0
- package/dist/runtime/udsConfig.d.ts +18 -0
- package/dist/runtime/udsConfig.js +18 -0
- package/dist/styles/styler.d.cts +10 -10
- package/dist/styles/styler.d.ts +10 -10
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/types/dist/index.d.cts +2 -0
- package/dist/types/dist/index.d.ts +2 -0
- package/dist/uds/generated/componentData.cjs +351 -234
- package/dist/uds/generated/componentData.js +351 -234
- package/dist/uds/generated/tailwindPurge.cjs +38 -2
- package/dist/uds/generated/tailwindPurge.js +38 -2
- package/dist/uds/package.cjs +2 -2
- package/dist/uds/package.js +2 -2
- package/generated/componentData.json +585 -418
- package/generated/tailwindPurge.ts +3 -3
- package/package.json +3 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createUDSConfigProvider } from "../providers/createUDSConfigProvider.js";
|
|
4
|
+
//#region src/components/client/Select/UDSSelectItemConfigProvider.tsx
|
|
5
|
+
const { Provider: UDSSelectItemConfigProvider, useConfigContext } = createUDSConfigProvider("SelectItem");
|
|
6
|
+
/** The icon size SelectItem hardcoded before runtime config support. */
|
|
7
|
+
const selectItemFallbackIconSize = "sm";
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the configured start/end icon sizes for SelectItem.
|
|
10
|
+
*
|
|
11
|
+
* Unlike other UDS config hooks, this hook does not require a provider:
|
|
12
|
+
* SelectItem is used in many apps without a `UDSConfigProvider`, so it
|
|
13
|
+
* gracefully falls back to the previously hardcoded icon size (`sm`) when no
|
|
14
|
+
* config is present.
|
|
15
|
+
*/
|
|
16
|
+
const useSelectItemConfig = () => {
|
|
17
|
+
const context = useConfigContext();
|
|
18
|
+
if (!context) return {
|
|
19
|
+
startIconSize: selectItemFallbackIconSize,
|
|
20
|
+
endIconSize: selectItemFallbackIconSize
|
|
21
|
+
};
|
|
22
|
+
const size = context.defaultSize;
|
|
23
|
+
return {
|
|
24
|
+
startIconSize: context.startIconSize[size],
|
|
25
|
+
endIconSize: context.endIconSize[size]
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { UDSSelectItemConfigProvider, useSelectItemConfig };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_components_client_Select_UDSSelectItemConfigProvider = require("./UDSSelectItemConfigProvider.cjs");
|
|
4
5
|
const require_components_client_Select_Select = require("./Select.cjs");
|
|
5
6
|
const require_components_client_Select_SelectContent = require("./SelectContent.cjs");
|
|
6
7
|
const require_components_client_Select_SelectDivider = require("./SelectDivider.cjs");
|
|
@@ -9,3 +10,5 @@ exports.Select = require_components_client_Select_Select.Select;
|
|
|
9
10
|
exports.SelectContent = require_components_client_Select_SelectContent.SelectContent;
|
|
10
11
|
exports.SelectDivider = require_components_client_Select_SelectDivider.SelectDivider;
|
|
11
12
|
exports.SelectItem = require_components_client_Select_SelectItem.SelectItem;
|
|
13
|
+
exports.UDSSelectItemConfigProvider = require_components_client_Select_UDSSelectItemConfigProvider.UDSSelectItemConfigProvider;
|
|
14
|
+
exports.useSelectItemConfig = require_components_client_Select_UDSSelectItemConfigProvider.useSelectItemConfig;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
import { UDSSelectItemConfigContextType } from "../../../runtime/selectItemConfig.cjs";
|
|
2
3
|
import { Select, SelectProps } from "./Select.cjs";
|
|
3
4
|
import { SelectContent, SelectContentProps } from "./SelectContent.cjs";
|
|
4
5
|
import { SelectDivider, SelectDividerProps } from "./SelectDivider.cjs";
|
|
5
6
|
import { SelectItem, SelectItemProps } from "./SelectItem.cjs";
|
|
6
|
-
|
|
7
|
+
import { UDSSelectItemConfigProvider, UDSSelectItemConfigProviderProps, useSelectItemConfig } from "./UDSSelectItemConfigProvider.cjs";
|
|
8
|
+
export { Select, SelectContent, SelectContentProps, SelectDivider, SelectDividerProps, SelectItem, SelectItemProps, SelectProps, UDSSelectItemConfigContextType, UDSSelectItemConfigProvider, UDSSelectItemConfigProviderProps, useSelectItemConfig };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
+
import { UDSSelectItemConfigContextType } from "../../../runtime/selectItemConfig.js";
|
|
3
4
|
import { Select, SelectProps } from "./Select.js";
|
|
4
5
|
import { SelectContent, SelectContentProps } from "./SelectContent.js";
|
|
5
6
|
import { SelectDivider, SelectDividerProps } from "./SelectDivider.js";
|
|
6
7
|
import { SelectItem, SelectItemProps } from "./SelectItem.js";
|
|
7
|
-
|
|
8
|
+
import { UDSSelectItemConfigProvider, UDSSelectItemConfigProviderProps, useSelectItemConfig } from "./UDSSelectItemConfigProvider.js";
|
|
9
|
+
export { Select, SelectContent, SelectContentProps, SelectDivider, SelectDividerProps, SelectItem, SelectItemProps, SelectProps, UDSSelectItemConfigContextType, UDSSelectItemConfigProvider, UDSSelectItemConfigProviderProps, useSelectItemConfig };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
|
+
import { UDSSelectItemConfigProvider, useSelectItemConfig } from "./UDSSelectItemConfigProvider.js";
|
|
3
4
|
import { Select } from "./Select.js";
|
|
4
5
|
import { SelectContent } from "./SelectContent.js";
|
|
5
6
|
import { SelectDivider } from "./SelectDivider.js";
|
|
6
7
|
import { SelectItem } from "./SelectItem.js";
|
|
7
|
-
export { Select, SelectContent, SelectDivider, SelectItem };
|
|
8
|
+
export { Select, SelectContent, SelectDivider, SelectItem, UDSSelectItemConfigProvider, useSelectItemConfig };
|
|
@@ -5,6 +5,7 @@ require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
5
5
|
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
6
|
const require_components_IconSlot = require("../../IconSlot.cjs");
|
|
7
7
|
const require_components_Text = require("../../Text.cjs");
|
|
8
|
+
const require_components_client_Tabs_UDSTabConfigProvider = require("./UDSTabConfigProvider.cjs");
|
|
8
9
|
const require_components_client_Tabs_tabsContext = require("./tabsContext.cjs");
|
|
9
10
|
let react = require("react");
|
|
10
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -16,6 +17,7 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
16
17
|
const generatedId = (0, react.useId)();
|
|
17
18
|
const uid = value ?? `uds-tab-${generatedId}`;
|
|
18
19
|
const { variant, reduceMotion } = require_components_client_Tabs_tabsContext.useTabsContext();
|
|
20
|
+
const { iconSize } = require_components_client_Tabs_UDSTabConfigProvider.useTabConfig();
|
|
19
21
|
const store = (0, _ariakit_react.useTabContext)();
|
|
20
22
|
if (!store) throw new Error("Tab must be wrapped in a Tabs component");
|
|
21
23
|
const selectedId = (0, _ariakit_react.useStoreState)(store, "selectedId");
|
|
@@ -54,7 +56,7 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
54
56
|
startIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
55
57
|
icon: startIcon,
|
|
56
58
|
iconProps: {
|
|
57
|
-
size:
|
|
59
|
+
size: iconSize,
|
|
58
60
|
color: "current"
|
|
59
61
|
},
|
|
60
62
|
className: iconConfigClass,
|
|
@@ -70,7 +72,7 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
70
72
|
endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
71
73
|
icon: endIcon,
|
|
72
74
|
iconProps: {
|
|
73
|
-
size:
|
|
75
|
+
size: iconSize,
|
|
74
76
|
color: "current"
|
|
75
77
|
},
|
|
76
78
|
className: iconConfigClass,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
4
|
import { IconSlot } from "../../IconSlot.js";
|
|
5
5
|
import { Text } from "../../Text.js";
|
|
6
|
+
import { useTabConfig } from "./UDSTabConfigProvider.js";
|
|
6
7
|
import { useTabsContext } from "./tabsContext.js";
|
|
7
8
|
import { isValidElement, useId } from "react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -14,6 +15,7 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
14
15
|
const generatedId = useId();
|
|
15
16
|
const uid = value ?? `uds-tab-${generatedId}`;
|
|
16
17
|
const { variant, reduceMotion } = useTabsContext();
|
|
18
|
+
const { iconSize } = useTabConfig();
|
|
17
19
|
const store = useTabContext();
|
|
18
20
|
if (!store) throw new Error("Tab must be wrapped in a Tabs component");
|
|
19
21
|
const selectedId = useStoreState(store, "selectedId");
|
|
@@ -52,7 +54,7 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
52
54
|
startIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
53
55
|
icon: startIcon,
|
|
54
56
|
iconProps: {
|
|
55
|
-
size:
|
|
57
|
+
size: iconSize,
|
|
56
58
|
color: "current"
|
|
57
59
|
},
|
|
58
60
|
className: iconConfigClass,
|
|
@@ -68,7 +70,7 @@ function Tab({ value, children, startIcon, endIcon, disabled, asChild = false, c
|
|
|
68
70
|
endIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
69
71
|
icon: endIcon,
|
|
70
72
|
iconProps: {
|
|
71
|
-
size:
|
|
73
|
+
size: iconSize,
|
|
72
74
|
color: "current"
|
|
73
75
|
},
|
|
74
76
|
className: iconConfigClass,
|
|
@@ -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
|
+
//#region src/components/client/Tabs/UDSTabConfigProvider.tsx
|
|
5
|
+
const { Provider: UDSTabConfigProvider, useConfigContext } = require("../providers/createUDSConfigProvider.cjs").createUDSConfigProvider("Tab");
|
|
6
|
+
/** The icon size Tab hardcoded before runtime config support. */
|
|
7
|
+
const tabFallbackIconSize = "sm";
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the configured icon size for Tab.
|
|
10
|
+
*
|
|
11
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Tab is
|
|
12
|
+
* used in many apps without a `UDSConfigProvider`, so it gracefully falls back
|
|
13
|
+
* to the previously hardcoded icon size (`sm`) when no config is present.
|
|
14
|
+
*/
|
|
15
|
+
const useTabConfig = () => {
|
|
16
|
+
const context = useConfigContext();
|
|
17
|
+
if (!context) return { iconSize: tabFallbackIconSize };
|
|
18
|
+
return { iconSize: context.iconSize[context.defaultSize] };
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.UDSTabConfigProvider = UDSTabConfigProvider;
|
|
22
|
+
exports.useTabConfig = useTabConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconSize } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { UDSConfigProviderProps } from "../providers/createUDSConfigProvider.cjs";
|
|
4
|
+
import { UDSTabConfigContextType } from "../../../runtime/tabConfig.cjs";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Tabs/UDSTabConfigProvider.d.ts
|
|
8
|
+
declare const UDSTabConfigProvider: {
|
|
9
|
+
({
|
|
10
|
+
children,
|
|
11
|
+
value
|
|
12
|
+
}: UDSConfigProviderProps<UDSTabConfigContextType>): _$react_jsx_runtime0.JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
type UDSTabConfigProviderProps = UDSConfigProviderProps<UDSTabConfigContextType>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the configured icon size for Tab.
|
|
18
|
+
*
|
|
19
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Tab is
|
|
20
|
+
* used in many apps without a `UDSConfigProvider`, so it gracefully falls back
|
|
21
|
+
* to the previously hardcoded icon size (`sm`) when no config is present.
|
|
22
|
+
*/
|
|
23
|
+
declare const useTabConfig: () => {
|
|
24
|
+
iconSize: IconSize;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type UDSTabConfigContextType, UDSTabConfigProvider, type UDSTabConfigProviderProps, useTabConfig };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { IconSize } from "../../../types/dist/index.js";
|
|
4
|
+
import { UDSConfigProviderProps } from "../providers/createUDSConfigProvider.js";
|
|
5
|
+
import { UDSTabConfigContextType } from "../../../runtime/tabConfig.js";
|
|
6
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Tabs/UDSTabConfigProvider.d.ts
|
|
9
|
+
declare const UDSTabConfigProvider: {
|
|
10
|
+
({
|
|
11
|
+
children,
|
|
12
|
+
value
|
|
13
|
+
}: UDSConfigProviderProps<UDSTabConfigContextType>): _$react_jsx_runtime0.JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
type UDSTabConfigProviderProps = UDSConfigProviderProps<UDSTabConfigContextType>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the configured icon size for Tab.
|
|
19
|
+
*
|
|
20
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Tab is
|
|
21
|
+
* used in many apps without a `UDSConfigProvider`, so it gracefully falls back
|
|
22
|
+
* to the previously hardcoded icon size (`sm`) when no config is present.
|
|
23
|
+
*/
|
|
24
|
+
declare const useTabConfig: () => {
|
|
25
|
+
iconSize: IconSize;
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { type UDSTabConfigContextType, UDSTabConfigProvider, type UDSTabConfigProviderProps, useTabConfig };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createUDSConfigProvider } from "../providers/createUDSConfigProvider.js";
|
|
4
|
+
//#region src/components/client/Tabs/UDSTabConfigProvider.tsx
|
|
5
|
+
const { Provider: UDSTabConfigProvider, useConfigContext } = createUDSConfigProvider("Tab");
|
|
6
|
+
/** The icon size Tab hardcoded before runtime config support. */
|
|
7
|
+
const tabFallbackIconSize = "sm";
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the configured icon size for Tab.
|
|
10
|
+
*
|
|
11
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Tab is
|
|
12
|
+
* used in many apps without a `UDSConfigProvider`, so it gracefully falls back
|
|
13
|
+
* to the previously hardcoded icon size (`sm`) when no config is present.
|
|
14
|
+
*/
|
|
15
|
+
const useTabConfig = () => {
|
|
16
|
+
const context = useConfigContext();
|
|
17
|
+
if (!context) return { iconSize: tabFallbackIconSize };
|
|
18
|
+
return { iconSize: context.iconSize[context.defaultSize] };
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { UDSTabConfigProvider, useTabConfig };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_components_client_Tabs_UDSTabConfigProvider = require("./UDSTabConfigProvider.cjs");
|
|
4
5
|
const require_components_client_Tabs_Tab = require("./Tab.cjs");
|
|
5
6
|
const require_components_client_Tabs_TabList = require("./TabList.cjs");
|
|
6
7
|
const require_components_client_Tabs_TabPanel = require("./TabPanel.cjs");
|
|
@@ -9,3 +10,5 @@ exports.Tab = require_components_client_Tabs_Tab.Tab;
|
|
|
9
10
|
exports.TabList = require_components_client_Tabs_TabList.TabList;
|
|
10
11
|
exports.TabPanel = require_components_client_Tabs_TabPanel.TabPanel;
|
|
11
12
|
exports.Tabs = require_components_client_Tabs_Tabs.Tabs;
|
|
13
|
+
exports.UDSTabConfigProvider = require_components_client_Tabs_UDSTabConfigProvider.UDSTabConfigProvider;
|
|
14
|
+
exports.useTabConfig = require_components_client_Tabs_UDSTabConfigProvider.useTabConfig;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
import { UDSTabConfigContextType } from "../../../runtime/tabConfig.cjs";
|
|
2
3
|
import { Tab, TabProps } from "./Tab.cjs";
|
|
3
4
|
import { TabList, TabListProps } from "./TabList.cjs";
|
|
4
5
|
import { TabPanel, TabPanelProps } from "./TabPanel.cjs";
|
|
5
6
|
import { Tabs, TabsProps } from "./Tabs.cjs";
|
|
6
7
|
import { TabsVariant } from "./tabsContext.cjs";
|
|
7
|
-
|
|
8
|
+
import { UDSTabConfigProvider, UDSTabConfigProviderProps, useTabConfig } from "./UDSTabConfigProvider.cjs";
|
|
9
|
+
export { Tab, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps, type TabsVariant, UDSTabConfigContextType, UDSTabConfigProvider, UDSTabConfigProviderProps, useTabConfig };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
+
import { UDSTabConfigContextType } from "../../../runtime/tabConfig.js";
|
|
3
4
|
import { Tab, TabProps } from "./Tab.js";
|
|
4
5
|
import { TabList, TabListProps } from "./TabList.js";
|
|
5
6
|
import { TabPanel, TabPanelProps } from "./TabPanel.js";
|
|
6
7
|
import { Tabs, TabsProps } from "./Tabs.js";
|
|
7
8
|
import { TabsVariant } from "./tabsContext.js";
|
|
8
|
-
|
|
9
|
+
import { UDSTabConfigProvider, UDSTabConfigProviderProps, useTabConfig } from "./UDSTabConfigProvider.js";
|
|
10
|
+
export { Tab, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps, type TabsVariant, UDSTabConfigContextType, UDSTabConfigProvider, UDSTabConfigProviderProps, useTabConfig };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
"use client";
|
|
3
|
+
import { UDSTabConfigProvider, useTabConfig } from "./UDSTabConfigProvider.js";
|
|
3
4
|
import { Tab } from "./Tab.js";
|
|
4
5
|
import { TabList } from "./TabList.js";
|
|
5
6
|
import { TabPanel } from "./TabPanel.js";
|
|
6
7
|
import { Tabs } from "./Tabs.js";
|
|
7
|
-
export { Tab, TabList, TabPanel, Tabs };
|
|
8
|
+
export { Tab, TabList, TabPanel, Tabs, UDSTabConfigProvider, useTabConfig };
|
|
@@ -35,7 +35,7 @@ let _ariakit_react = require("@ariakit/react");
|
|
|
35
35
|
*
|
|
36
36
|
* @related [Toast](https://uds.build/docs/components/toast), [Popover](https://uds.build/docs/components/popover)
|
|
37
37
|
**/
|
|
38
|
-
function Tooltip({ children, placement, open, portal = true }) {
|
|
38
|
+
function Tooltip({ children, placement, open, portal = true, hideArrow = false }) {
|
|
39
39
|
const isControlled = open !== void 0;
|
|
40
40
|
const controlledProps = isControlled ? {
|
|
41
41
|
showTimeout: 0,
|
|
@@ -47,7 +47,8 @@ function Tooltip({ children, placement, open, portal = true }) {
|
|
|
47
47
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Tooltip_tooltipContext.TooltipInternalContext.Provider, {
|
|
48
48
|
value: {
|
|
49
49
|
portal,
|
|
50
|
-
isControlled
|
|
50
|
+
isControlled,
|
|
51
|
+
hideArrow
|
|
51
52
|
},
|
|
52
53
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipProvider, {
|
|
53
54
|
placement: ariaKitPlacement,
|
|
@@ -33,7 +33,7 @@ import { TooltipProvider } from "@ariakit/react";
|
|
|
33
33
|
*
|
|
34
34
|
* @related [Toast](https://uds.build/docs/components/toast), [Popover](https://uds.build/docs/components/popover)
|
|
35
35
|
**/
|
|
36
|
-
function Tooltip({ children, placement, open, portal = true }) {
|
|
36
|
+
function Tooltip({ children, placement, open, portal = true, hideArrow = false }) {
|
|
37
37
|
const isControlled = open !== void 0;
|
|
38
38
|
const controlledProps = isControlled ? {
|
|
39
39
|
showTimeout: 0,
|
|
@@ -45,7 +45,8 @@ function Tooltip({ children, placement, open, portal = true }) {
|
|
|
45
45
|
return /* @__PURE__ */ jsx(TooltipInternalContext.Provider, {
|
|
46
46
|
value: {
|
|
47
47
|
portal,
|
|
48
|
-
isControlled
|
|
48
|
+
isControlled,
|
|
49
|
+
hideArrow
|
|
49
50
|
},
|
|
50
51
|
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
51
52
|
placement: ariaKitPlacement,
|
|
@@ -20,6 +20,7 @@ let _ariakit_react = require("@ariakit/react");
|
|
|
20
20
|
const ARROW_HEIGHT = 8;
|
|
21
21
|
const ARROW_WIDTH = 12;
|
|
22
22
|
const ARROW_TIP_RADIUS_FRACTION = .5;
|
|
23
|
+
const GUTTER = 10;
|
|
23
24
|
const TooltipContent = (0, react.forwardRef)(function TooltipContent({ children, maxWidth, startTitleIcon, title, endContent, className, id, slotProps }, ref) {
|
|
24
25
|
const store = (0, _ariakit_react.useTooltipContext)();
|
|
25
26
|
const open = (0, _ariakit_react.useStoreState)(store, "open");
|
|
@@ -36,6 +37,7 @@ const TooltipContent = (0, react.forwardRef)(function TooltipContent({ children,
|
|
|
36
37
|
borderRadius: defaultBorderRadius,
|
|
37
38
|
arrowRef,
|
|
38
39
|
animationDuration,
|
|
40
|
+
hideArrow: internalContext?.hideArrow,
|
|
39
41
|
arrowWidth: ARROW_WIDTH,
|
|
40
42
|
arrowHeight: ARROW_HEIGHT,
|
|
41
43
|
arrowTipRadiusFraction: ARROW_TIP_RADIUS_FRACTION
|
|
@@ -74,7 +76,7 @@ const TooltipContent = (0, react.forwardRef)(function TooltipContent({ children,
|
|
|
74
76
|
hideOnHoverOutside: internalContext?.isControlled ? false : void 0,
|
|
75
77
|
hideOnInteractOutside: internalContext?.isControlled ? false : void 0,
|
|
76
78
|
portal: internalContext ? internalContext.portal : true,
|
|
77
|
-
gutter:
|
|
79
|
+
gutter: GUTTER,
|
|
78
80
|
updatePosition: onPositionUpdate,
|
|
79
81
|
getAnchorRect: require_utils_getUnscaledAnchorRect.getUnscaledAnchorRect,
|
|
80
82
|
style: {
|
|
@@ -120,7 +122,7 @@ const TooltipContent = (0, react.forwardRef)(function TooltipContent({ children,
|
|
|
120
122
|
}) : endContent]
|
|
121
123
|
})]
|
|
122
124
|
})
|
|
123
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipArrow, {
|
|
125
|
+
}), !internalContext?.hideArrow && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipArrow, {
|
|
124
126
|
ref: arrowRef,
|
|
125
127
|
style: { opacity: 0 },
|
|
126
128
|
...slotProps?.arrow
|
|
@@ -18,6 +18,7 @@ import { Tooltip, TooltipArrow, useStoreState, useTooltipContext } from "@ariaki
|
|
|
18
18
|
const ARROW_HEIGHT = 8;
|
|
19
19
|
const ARROW_WIDTH = 12;
|
|
20
20
|
const ARROW_TIP_RADIUS_FRACTION = .5;
|
|
21
|
+
const GUTTER = 10;
|
|
21
22
|
const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth, startTitleIcon, title, endContent, className, id, slotProps }, ref) {
|
|
22
23
|
const store = useTooltipContext();
|
|
23
24
|
const open = useStoreState(store, "open");
|
|
@@ -34,6 +35,7 @@ const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth,
|
|
|
34
35
|
borderRadius: defaultBorderRadius,
|
|
35
36
|
arrowRef,
|
|
36
37
|
animationDuration,
|
|
38
|
+
hideArrow: internalContext?.hideArrow,
|
|
37
39
|
arrowWidth: ARROW_WIDTH,
|
|
38
40
|
arrowHeight: ARROW_HEIGHT,
|
|
39
41
|
arrowTipRadiusFraction: ARROW_TIP_RADIUS_FRACTION
|
|
@@ -72,7 +74,7 @@ const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth,
|
|
|
72
74
|
hideOnHoverOutside: internalContext?.isControlled ? false : void 0,
|
|
73
75
|
hideOnInteractOutside: internalContext?.isControlled ? false : void 0,
|
|
74
76
|
portal: internalContext ? internalContext.portal : true,
|
|
75
|
-
gutter:
|
|
77
|
+
gutter: GUTTER,
|
|
76
78
|
updatePosition: onPositionUpdate,
|
|
77
79
|
getAnchorRect: getUnscaledAnchorRect,
|
|
78
80
|
style: {
|
|
@@ -118,7 +120,7 @@ const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth,
|
|
|
118
120
|
}) : endContent]
|
|
119
121
|
})]
|
|
120
122
|
})
|
|
121
|
-
}), /* @__PURE__ */ jsx(TooltipArrow, {
|
|
123
|
+
}), !internalContext?.hideArrow && /* @__PURE__ */ jsx(TooltipArrow, {
|
|
122
124
|
ref: arrowRef,
|
|
123
125
|
style: { opacity: 0 },
|
|
124
126
|
...slotProps?.arrow
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
//#region src/components/client/UDSBadgeConfigProvider.tsx
|
|
5
|
+
const { Provider: UDSBadgeConfigProvider, useConfigContext } = require("./providers/createUDSConfigProvider.cjs").createUDSConfigProvider("Badge");
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the configured icon size for a Badge size.
|
|
8
|
+
*
|
|
9
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Badge
|
|
10
|
+
* is used in many apps without a `UDSConfigProvider`, so it gracefully falls
|
|
11
|
+
* back to `undefined` (letting `Icon` apply its own default size) when no
|
|
12
|
+
* config is present — preserving the previous rendering exactly.
|
|
13
|
+
*/
|
|
14
|
+
const useBadgeConfig = (sizeProp) => {
|
|
15
|
+
const context = useConfigContext();
|
|
16
|
+
if (!context) return {
|
|
17
|
+
size: sizeProp,
|
|
18
|
+
iconSize: void 0
|
|
19
|
+
};
|
|
20
|
+
const size = sizeProp ?? context.defaultSize;
|
|
21
|
+
return {
|
|
22
|
+
size,
|
|
23
|
+
iconSize: context.iconSize[size]
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.UDSBadgeConfigProvider = UDSBadgeConfigProvider;
|
|
28
|
+
exports.useBadgeConfig = useBadgeConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import { BadgeSize, IconSize } from "../../types/dist/index.cjs";
|
|
3
|
+
import { UDSConfigProviderProps } from "./providers/createUDSConfigProvider.cjs";
|
|
4
|
+
import { UDSBadgeConfigContextType } from "../../runtime/badgeConfig.cjs";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/UDSBadgeConfigProvider.d.ts
|
|
8
|
+
declare const UDSBadgeConfigProvider: {
|
|
9
|
+
({
|
|
10
|
+
children,
|
|
11
|
+
value
|
|
12
|
+
}: UDSConfigProviderProps<UDSBadgeConfigContextType>): _$react_jsx_runtime0.JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
type UDSBadgeConfigProviderProps = UDSConfigProviderProps<UDSBadgeConfigContextType>;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the configured icon size for a Badge size.
|
|
18
|
+
*
|
|
19
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Badge
|
|
20
|
+
* is used in many apps without a `UDSConfigProvider`, so it gracefully falls
|
|
21
|
+
* back to `undefined` (letting `Icon` apply its own default size) when no
|
|
22
|
+
* config is present — preserving the previous rendering exactly.
|
|
23
|
+
*/
|
|
24
|
+
declare const useBadgeConfig: (sizeProp?: BadgeSize | undefined) => {
|
|
25
|
+
size: BadgeSize | undefined;
|
|
26
|
+
iconSize: IconSize | undefined;
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { type UDSBadgeConfigContextType, UDSBadgeConfigProvider, type UDSBadgeConfigProviderProps, useBadgeConfig };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { BadgeSize, IconSize } from "../../types/dist/index.js";
|
|
4
|
+
import { UDSConfigProviderProps } from "./providers/createUDSConfigProvider.js";
|
|
5
|
+
import { UDSBadgeConfigContextType } from "../../runtime/badgeConfig.js";
|
|
6
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/UDSBadgeConfigProvider.d.ts
|
|
9
|
+
declare const UDSBadgeConfigProvider: {
|
|
10
|
+
({
|
|
11
|
+
children,
|
|
12
|
+
value
|
|
13
|
+
}: UDSConfigProviderProps<UDSBadgeConfigContextType>): _$react_jsx_runtime0.JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
type UDSBadgeConfigProviderProps = UDSConfigProviderProps<UDSBadgeConfigContextType>;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the configured icon size for a Badge size.
|
|
19
|
+
*
|
|
20
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Badge
|
|
21
|
+
* is used in many apps without a `UDSConfigProvider`, so it gracefully falls
|
|
22
|
+
* back to `undefined` (letting `Icon` apply its own default size) when no
|
|
23
|
+
* config is present — preserving the previous rendering exactly.
|
|
24
|
+
*/
|
|
25
|
+
declare const useBadgeConfig: (sizeProp?: BadgeSize | undefined) => {
|
|
26
|
+
size: BadgeSize | undefined;
|
|
27
|
+
iconSize: IconSize | undefined;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { type UDSBadgeConfigContextType, UDSBadgeConfigProvider, type UDSBadgeConfigProviderProps, useBadgeConfig };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createUDSConfigProvider } from "./providers/createUDSConfigProvider.js";
|
|
4
|
+
//#region src/components/client/UDSBadgeConfigProvider.tsx
|
|
5
|
+
const { Provider: UDSBadgeConfigProvider, useConfigContext } = createUDSConfigProvider("Badge");
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the configured icon size for a Badge size.
|
|
8
|
+
*
|
|
9
|
+
* Unlike other UDS config hooks, this hook does not require a provider: Badge
|
|
10
|
+
* is used in many apps without a `UDSConfigProvider`, so it gracefully falls
|
|
11
|
+
* back to `undefined` (letting `Icon` apply its own default size) when no
|
|
12
|
+
* config is present — preserving the previous rendering exactly.
|
|
13
|
+
*/
|
|
14
|
+
const useBadgeConfig = (sizeProp) => {
|
|
15
|
+
const context = useConfigContext();
|
|
16
|
+
if (!context) return {
|
|
17
|
+
size: sizeProp,
|
|
18
|
+
iconSize: void 0
|
|
19
|
+
};
|
|
20
|
+
const size = sizeProp ?? context.defaultSize;
|
|
21
|
+
return {
|
|
22
|
+
size,
|
|
23
|
+
iconSize: context.iconSize[size]
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { UDSBadgeConfigProvider, useBadgeConfig };
|