@yahoo/uds 3.131.0-beta.2 → 3.132.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/automated-config/dist/properties.d.cts +1 -1
- package/dist/automated-config/dist/properties.d.ts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +1 -1
- package/dist/components/Banner/Banner.cjs +5 -2
- package/dist/components/Banner/Banner.d.cts +10 -1
- package/dist/components/Banner/Banner.d.ts +10 -1
- package/dist/components/Banner/Banner.js +5 -2
- package/dist/components/Banner/utils.d.cts +1 -1
- package/dist/components/Banner/utils.d.ts +1 -1
- package/dist/components/Box.d.cts +1 -1
- package/dist/components/Box.d.ts +1 -1
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/DividerCore.cjs +17 -10
- package/dist/components/Divider/DividerCore.d.cts +11 -5
- package/dist/components/Divider/DividerCore.d.ts +11 -5
- package/dist/components/Divider/DividerCore.js +17 -10
- package/dist/components/Divider/DividerInternal.cjs +15 -11
- package/dist/components/Divider/DividerInternal.d.cts +1 -1
- package/dist/components/Divider/DividerInternal.d.ts +1 -1
- package/dist/components/Divider/DividerInternal.js +15 -11
- package/dist/components/FormLabel.d.cts +1 -1
- package/dist/components/FormLabel.d.ts +1 -1
- package/dist/components/HStack.d.cts +1 -1
- package/dist/components/HStack.d.ts +1 -1
- package/dist/components/Icon.cjs +6 -15
- package/dist/components/Icon.d.cts +1 -0
- package/dist/components/Icon.d.ts +1 -0
- package/dist/components/Icon.js +7 -16
- package/dist/components/IconSlot.cjs +6 -25
- package/dist/components/IconSlot.d.cts +2 -3
- package/dist/components/IconSlot.d.ts +2 -3
- package/dist/components/IconSlot.js +5 -25
- package/dist/components/Image.d.cts +1 -1
- package/dist/components/Image.d.ts +1 -1
- package/dist/components/Link.cjs +13 -6
- package/dist/components/Link.d.cts +11 -1
- package/dist/components/Link.d.ts +11 -1
- package/dist/components/Link.js +13 -6
- package/dist/components/Text.d.cts +1 -1
- package/dist/components/Text.d.ts +1 -1
- package/dist/components/VStack.d.cts +1 -1
- package/dist/components/VStack.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.cts +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarImage.d.cts +1 -1
- package/dist/components/client/Avatar/AvatarImage.d.ts +1 -1
- package/dist/components/client/Avatar/AvatarText.d.cts +1 -1
- package/dist/components/client/Avatar/AvatarText.d.ts +1 -1
- package/dist/components/client/Avatar/utils.d.cts +1 -1
- package/dist/components/client/Avatar/utils.d.ts +1 -1
- package/dist/components/client/Badge.cjs +10 -4
- package/dist/components/client/Badge.d.cts +13 -2
- package/dist/components/client/Badge.d.ts +13 -2
- package/dist/components/client/Badge.js +10 -4
- package/dist/components/client/BottomSheet/BottomSheet.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +1 -1
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +1 -1
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +1 -1
- package/dist/components/client/BottomSheet/utils.d.cts +1 -1
- package/dist/components/client/BottomSheet/utils.d.ts +1 -1
- package/dist/components/client/Button.cjs +20 -9
- package/dist/components/client/Button.d.cts +13 -2
- package/dist/components/client/Button.d.ts +13 -2
- package/dist/components/client/Button.js +20 -9
- package/dist/components/client/Checkbox.cjs +14 -6
- package/dist/components/client/Checkbox.d.cts +10 -5
- package/dist/components/client/Checkbox.d.ts +10 -5
- package/dist/components/client/Checkbox.js +14 -6
- package/dist/components/client/Chip/Chip.d.cts +1 -1
- package/dist/components/client/Chip/Chip.d.ts +1 -1
- package/dist/components/client/Chip/ChipBase.d.cts +1 -1
- package/dist/components/client/Chip/ChipBase.d.ts +1 -1
- package/dist/components/client/Chip/ChipButton.d.cts +1 -1
- package/dist/components/client/Chip/ChipButton.d.ts +1 -1
- package/dist/components/client/Chip/ChipDismissible.d.cts +1 -1
- package/dist/components/client/Chip/ChipDismissible.d.ts +1 -1
- package/dist/components/client/Chip/ChipLink.d.cts +1 -1
- package/dist/components/client/Chip/ChipLink.d.ts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.cts +1 -1
- package/dist/components/client/Chip/ChipToggle.d.ts +1 -1
- package/dist/components/client/IconButton.cjs +5 -8
- package/dist/components/client/IconButton.d.cts +10 -2
- package/dist/components/client/IconButton.d.ts +10 -2
- package/dist/components/client/IconButton.js +5 -8
- package/dist/components/client/Input/Input.cjs +8 -2
- package/dist/components/client/Input/Input.d.cts +4 -1
- package/dist/components/client/Input/Input.d.ts +4 -1
- package/dist/components/client/Input/Input.js +8 -2
- package/dist/components/client/Input/InputHelpTextInternal.cjs +16 -6
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +11 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +11 -1
- package/dist/components/client/Input/InputHelpTextInternal.js +16 -6
- package/dist/components/client/Menu/Menu.Content.cjs +2 -1
- package/dist/components/client/Menu/Menu.Content.d.cts +8 -1
- package/dist/components/client/Menu/Menu.Content.d.ts +8 -1
- package/dist/components/client/Menu/Menu.Content.js +2 -1
- package/dist/components/client/Menu/Menu.Divider.cjs +8 -10
- package/dist/components/client/Menu/Menu.Divider.js +8 -10
- package/dist/components/client/Menu/Menu.Item.cjs +23 -14
- package/dist/components/client/Menu/Menu.Item.d.cts +12 -1
- package/dist/components/client/Menu/Menu.Item.d.ts +12 -1
- package/dist/components/client/Menu/Menu.Item.js +24 -15
- package/dist/components/client/Menu/Menu.ItemBase.cjs +17 -9
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +10 -6
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +10 -6
- package/dist/components/client/Menu/Menu.ItemBase.js +17 -9
- package/dist/components/client/Menu/Menu.ItemCheckbox.cjs +10 -10
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.js +10 -10
- package/dist/components/client/Popover/Popover.d.cts +1 -1
- package/dist/components/client/Popover/Popover.d.ts +1 -1
- package/dist/components/client/Popover/PopoverContent.cjs +4 -1
- package/dist/components/client/Popover/PopoverContent.d.cts +4 -1
- package/dist/components/client/Popover/PopoverContent.d.ts +4 -1
- package/dist/components/client/Popover/PopoverContent.js +4 -1
- package/dist/components/client/Popover/PopoverTrigger.d.cts +1 -1
- package/dist/components/client/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +2 -2
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +2 -2
- package/dist/components/client/Popover/index.d.cts +1 -1
- package/dist/components/client/Popover/index.d.ts +1 -1
- package/dist/components/client/Pressable.d.cts +1 -1
- package/dist/components/client/Pressable.d.ts +1 -1
- package/dist/components/client/Radio/Radio.cjs +18 -15
- package/dist/components/client/Radio/Radio.d.cts +10 -5
- package/dist/components/client/Radio/Radio.d.ts +10 -5
- package/dist/components/client/Radio/Radio.js +18 -15
- package/dist/components/client/Radio/RadioGroupProvider.d.cts +1 -1
- package/dist/components/client/Radio/RadioGroupProvider.d.ts +1 -1
- package/dist/components/client/SpringMotionConfig.d.cts +1 -1
- package/dist/components/client/SpringMotionConfig.d.ts +1 -1
- package/dist/components/client/Switch.cjs +14 -6
- package/dist/components/client/Switch.d.cts +10 -6
- package/dist/components/client/Switch.d.ts +10 -6
- package/dist/components/client/Switch.js +14 -6
- package/dist/components/client/Tabs/Tab.cjs +11 -5
- package/dist/components/client/Tabs/Tab.d.cts +14 -3
- package/dist/components/client/Tabs/Tab.d.ts +14 -3
- package/dist/components/client/Tabs/Tab.js +11 -5
- package/dist/components/client/Tabs/TabList.d.cts +1 -1
- package/dist/components/client/Tabs/TabList.d.ts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.cts +1 -1
- package/dist/components/client/Tabs/TabPanel.d.ts +1 -1
- package/dist/components/client/Tabs/Tabs.d.cts +1 -1
- package/dist/components/client/Tabs/Tabs.d.ts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.cts +1 -1
- package/dist/components/client/Tabs/tabsContext.d.ts +1 -1
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/ToastContainer.d.cts +1 -1
- package/dist/components/client/Toast/ToastContainer.d.ts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/components/client/Toast/createToast.d.cts +1 -1
- package/dist/components/client/Toast/createToast.d.ts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.cts +1 -1
- package/dist/components/client/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/client/Tooltip/TooltipContent.cjs +9 -3
- package/dist/components/client/Tooltip/TooltipContent.d.cts +14 -3
- package/dist/components/client/Tooltip/TooltipContent.d.ts +14 -3
- package/dist/components/client/Tooltip/TooltipContent.js +9 -3
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +1 -1
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +1 -1
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +1 -1
- package/dist/components/client/Tooltip/index.d.cts +1 -1
- package/dist/components/client/Tooltip/index.d.ts +1 -1
- package/dist/components/client/buttonConstants.d.cts +1 -1
- package/dist/components/client/buttonConstants.d.ts +1 -1
- package/dist/components/client/index.d.cts +1 -1
- package/dist/components/client/index.d.ts +1 -1
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.cts +1 -1
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.ts +1 -1
- package/dist/components/experimental/Table.d.cts +1 -1
- package/dist/components/experimental/Table.d.ts +1 -1
- package/dist/components/experimental/client/SwitchV2.cjs +14 -6
- package/dist/components/experimental/client/SwitchV2.d.cts +10 -6
- package/dist/components/experimental/client/SwitchV2.d.ts +10 -6
- package/dist/components/experimental/client/SwitchV2.js +14 -6
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/config/dist/index.d.cts +1 -1
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/css-tokens/dist/index.d.cts +1 -1
- package/dist/css-tokens/dist/index.d.ts +1 -1
- package/dist/fixtures/dist/index.d.cts +1 -1
- package/dist/fixtures/dist/index.d.ts +1 -1
- package/dist/fixtures/index.d.cts +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fonts/dist/index.d.cts +1 -1
- package/dist/fonts/dist/index.d.ts +1 -1
- package/dist/icons/dist/types.d.cts +30 -0
- package/dist/icons/dist/types.d.ts +30 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/modes/dist/index.d.cts +1 -1
- package/dist/modes/dist/index.d.ts +1 -1
- package/dist/motion-tokens/dist/index.d.cts +1 -1
- package/dist/motion-tokens/dist/index.d.ts +1 -1
- package/dist/providers/ColorModeProvider.d.cts +1 -1
- package/dist/providers/ColorModeProvider.d.ts +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +1 -1
- package/dist/providers/ThemeProvider.d.cts +1 -1
- package/dist/providers/ThemeProvider.d.ts +1 -1
- package/dist/runtime/bottomSheetConfig.d.cts +1 -1
- package/dist/runtime/bottomSheetConfig.d.ts +1 -1
- package/dist/runtime/breakpointsConfig.d.cts +1 -1
- package/dist/runtime/breakpointsConfig.d.ts +1 -1
- package/dist/runtime/popoverConfig.d.cts +1 -1
- package/dist/runtime/popoverConfig.d.ts +1 -1
- package/dist/runtime/toastConfig.d.cts +1 -1
- package/dist/runtime/toastConfig.d.ts +1 -1
- package/dist/runtime/tooltipConfig.d.cts +1 -1
- package/dist/runtime/tooltipConfig.d.ts +1 -1
- package/dist/styles/styler.d.cts +76 -76
- package/dist/styles/styler.d.ts +76 -76
- package/dist/styles/stylerTypes.d.cts +1 -1
- package/dist/styles/stylerTypes.d.ts +1 -1
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/configs/borderRadius.d.cts +1 -1
- package/dist/tokens/configs/borderRadius.d.ts +1 -1
- package/dist/tokens/configs/borderWidth.d.cts +1 -1
- package/dist/tokens/configs/borderWidth.d.ts +1 -1
- package/dist/tokens/configs/font.d.cts +1 -1
- package/dist/tokens/configs/font.d.ts +1 -1
- package/dist/tokens/configs/scaleMode.d.cts +1 -1
- package/dist/tokens/configs/scaleMode.d.ts +1 -1
- package/dist/tokens/configs/shadow.d.cts +1 -1
- package/dist/tokens/configs/shadow.d.ts +1 -1
- package/dist/tokens/configs/sizes.d.cts +1 -1
- package/dist/tokens/configs/sizes.d.ts +1 -1
- package/dist/tokens/configs/typography.d.cts +1 -1
- package/dist/tokens/configs/typography.d.ts +1 -1
- package/dist/tokens/index.d.cts +2 -2
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/parseButtonVariants.d.cts +1 -1
- package/dist/tokens/parseButtonVariants.d.ts +1 -1
- package/dist/tokens/types.d.cts +7 -7
- package/dist/tokens/types.d.ts +7 -7
- package/dist/tokens/utils/spectrum.d.cts +1 -1
- package/dist/tokens/utils/spectrum.d.ts +1 -1
- package/dist/types/{src → dist}/index.d.cts +26 -38
- package/dist/types/{src → dist}/index.d.ts +26 -38
- package/dist/uds/generated/componentData.cjs +109 -106
- package/dist/uds/generated/componentData.js +109 -106
- package/dist/uds/generated/tailwindPurge.cjs +73 -73
- package/dist/uds/generated/tailwindPurge.js +73 -73
- package/dist/uds/package.cjs +1 -1
- package/dist/uds/package.js +1 -1
- package/dist/utils/isElevationAlias.d.cts +1 -1
- package/dist/utils/isElevationAlias.d.ts +1 -1
- package/generated/componentData.json +135 -124
- package/generated/tailwindPurge.ts +1 -1
- package/package.json +2 -2
package/dist/components/Icon.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { cx, getStyles } from "../styles/styler.js";
|
|
3
3
|
import { normalIconSizes } from "../tokens/configs/sizes.js";
|
|
4
|
-
import {
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { getIconMarkup, getIconVariants, isIconDefinition } from "@yahoo/uds-icons/utils";
|
|
7
6
|
|
|
8
7
|
//#region src/components/Icon.tsx
|
|
9
8
|
/**
|
|
@@ -35,10 +34,8 @@ import { getIconMarkup, getIconVariants, isIconDefinition } from "@yahoo/uds-ico
|
|
|
35
34
|
*
|
|
36
35
|
* @related [IconButton](https://uds.build/docs/components/icon-button)
|
|
37
36
|
*/
|
|
38
|
-
const Icon = forwardRef(function BaseIcon({ name:
|
|
39
|
-
const
|
|
40
|
-
const iconComponent = typeof iconName === "function" ? iconName : void 0;
|
|
41
|
-
const availableVariants = iconDefinition ? getIconVariants(iconDefinition) : [];
|
|
37
|
+
const Icon = forwardRef(function BaseIcon({ name: SVGIcon, size = "md", variant = "outline", color = "primary", className, ...props }, ref) {
|
|
38
|
+
const availableVariants = SVGIcon.metadata?.variants ?? [];
|
|
42
39
|
const effectiveVariant = availableVariants.includes(variant) ? variant : availableVariants[0] ?? "fill";
|
|
43
40
|
const isMulticolor = effectiveVariant === "multicolor";
|
|
44
41
|
const styles = getStyles({
|
|
@@ -47,14 +44,6 @@ const Icon = forwardRef(function BaseIcon({ name: iconName, size = "md", variant
|
|
|
47
44
|
className: cx(className, !isMulticolor && "[&_path]:fill-current")
|
|
48
45
|
});
|
|
49
46
|
const sizePx = normalIconSizes[size];
|
|
50
|
-
const renderedMarkup = iconDefinition ? getIconMarkup(iconDefinition, size, effectiveVariant) : null;
|
|
51
|
-
const renderedIcon = renderedMarkup ? null : isValidElement(iconName) ? cloneElement(iconName, {
|
|
52
|
-
size,
|
|
53
|
-
variant: effectiveVariant
|
|
54
|
-
}) : iconComponent ? iconComponent({
|
|
55
|
-
size,
|
|
56
|
-
variant: effectiveVariant
|
|
57
|
-
}) : null;
|
|
58
47
|
return /* @__PURE__ */ jsx("svg", {
|
|
59
48
|
ref,
|
|
60
49
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -64,9 +53,11 @@ const Icon = forwardRef(function BaseIcon({ name: iconName, size = "md", variant
|
|
|
64
53
|
"aria-hidden": "true",
|
|
65
54
|
focusable: "false",
|
|
66
55
|
className: styles,
|
|
67
|
-
dangerouslySetInnerHTML: renderedMarkup ? { __html: renderedMarkup } : void 0,
|
|
68
56
|
...props,
|
|
69
|
-
children:
|
|
57
|
+
children: /* @__PURE__ */ jsx(SVGIcon, {
|
|
58
|
+
size,
|
|
59
|
+
variant: effectiveVariant
|
|
60
|
+
})
|
|
70
61
|
});
|
|
71
62
|
});
|
|
72
63
|
Icon.displayName = "Icon";
|
|
@@ -6,12 +6,10 @@ const require_components_Icon = require('./Icon.cjs');
|
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_runtime.__toESM(react);
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
let
|
|
9
|
+
let lodash_isFunction_js = require("lodash/isFunction.js");
|
|
10
|
+
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
|
|
10
11
|
|
|
11
12
|
//#region src/components/IconSlot.tsx
|
|
12
|
-
function isIconRenderOutput(icon) {
|
|
13
|
-
return (0, react.isValidElement)(icon) && (icon.type === react.default.Fragment || typeof icon.type === "string");
|
|
14
|
-
}
|
|
15
13
|
/**
|
|
16
14
|
* A helper container to render a SvgIcon, Icon component, or ReactNode.
|
|
17
15
|
*
|
|
@@ -32,38 +30,21 @@ const IconSlot = (0, react.memo)(function IconSlot({ icon, iconProps, className:
|
|
|
32
30
|
if (!icon) return null;
|
|
33
31
|
const { className: iconPropsClassName, ...props } = iconProps || {};
|
|
34
32
|
const mergedClassName = require_styles_styler.cx(slotClassName, iconPropsClassName);
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const svgIcon = icon;
|
|
34
|
+
if (svgIcon.metadata?.isSvgIcon) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
35
|
+
name: svgIcon,
|
|
37
36
|
...props,
|
|
38
37
|
...rest,
|
|
39
38
|
className: mergedClassName
|
|
40
39
|
});
|
|
41
|
-
if (
|
|
40
|
+
if ((0, lodash_isFunction_js.default)(icon)) {
|
|
42
41
|
const iconEl = icon(iconProps || {});
|
|
43
|
-
if ((0, _yahoo_uds_icons_utils.isIconDefinition)(iconEl)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
44
|
-
name: iconEl,
|
|
45
|
-
...props,
|
|
46
|
-
...rest,
|
|
47
|
-
className: mergedClassName
|
|
48
|
-
});
|
|
49
|
-
if (isIconRenderOutput(iconEl)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
50
|
-
name: icon,
|
|
51
|
-
...props,
|
|
52
|
-
...rest,
|
|
53
|
-
className: mergedClassName
|
|
54
|
-
});
|
|
55
42
|
const elProps = iconEl?.props;
|
|
56
43
|
return (0, react.isValidElement)(iconEl) && (0, react.cloneElement)(iconEl, {
|
|
57
44
|
...rest,
|
|
58
45
|
className: require_styles_styler.cx(mergedClassName, elProps?.className)
|
|
59
46
|
});
|
|
60
47
|
}
|
|
61
|
-
if (isIconRenderOutput(icon)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
62
|
-
name: ((svgIconProps) => (0, react.cloneElement)(icon, svgIconProps)),
|
|
63
|
-
...props,
|
|
64
|
-
...rest,
|
|
65
|
-
className: mergedClassName
|
|
66
|
-
});
|
|
67
48
|
const elProps = icon.props;
|
|
68
49
|
return (0, react.isValidElement)(icon) && (0, react.cloneElement)(icon, {
|
|
69
50
|
...props,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalIconSlot } from "../types/
|
|
2
|
+
import { UniversalIconSlot } from "../types/dist/index.cjs";
|
|
3
3
|
import { IconPropsWithSVGProps } from "../tokens/types.cjs";
|
|
4
4
|
import "../tokens/index.cjs";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { IconDefinition } from "@yahoo/uds-icons/types";
|
|
7
6
|
|
|
8
7
|
//#region src/components/IconSlot.d.ts
|
|
9
8
|
interface IconSlotProps {
|
|
10
9
|
/** The icon to render. Can be a UDS icon, an Icon component, ReactNode, or a function that a ReactNode. */
|
|
11
|
-
icon?: UniversalIconSlot
|
|
10
|
+
icon?: UniversalIconSlot;
|
|
12
11
|
/** Props to spread onto the icon. */
|
|
13
12
|
iconProps?: Omit<IconPropsWithSVGProps, 'name'>;
|
|
14
13
|
className?: string;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalIconSlot } from "../types/
|
|
2
|
+
import { UniversalIconSlot } from "../types/dist/index.js";
|
|
3
3
|
import { IconPropsWithSVGProps } from "../tokens/types.js";
|
|
4
4
|
import "../tokens/index.js";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { IconDefinition } from "@yahoo/uds-icons/types";
|
|
7
6
|
|
|
8
7
|
//#region src/components/IconSlot.d.ts
|
|
9
8
|
interface IconSlotProps {
|
|
10
9
|
/** The icon to render. Can be a UDS icon, an Icon component, ReactNode, or a function that a ReactNode. */
|
|
11
|
-
icon?: UniversalIconSlot
|
|
10
|
+
icon?: UniversalIconSlot;
|
|
12
11
|
/** Props to spread onto the icon. */
|
|
13
12
|
iconProps?: Omit<IconPropsWithSVGProps, 'name'>;
|
|
14
13
|
className?: string;
|
|
@@ -3,12 +3,9 @@ import { cx } from "../styles/styler.js";
|
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
4
|
import React, { cloneElement, isValidElement, memo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { isFunction } from "lodash-es";
|
|
7
7
|
|
|
8
8
|
//#region src/components/IconSlot.tsx
|
|
9
|
-
function isIconRenderOutput(icon) {
|
|
10
|
-
return isValidElement(icon) && (icon.type === React.Fragment || typeof icon.type === "string");
|
|
11
|
-
}
|
|
12
9
|
/**
|
|
13
10
|
* A helper container to render a SvgIcon, Icon component, or ReactNode.
|
|
14
11
|
*
|
|
@@ -29,38 +26,21 @@ const IconSlot = memo(function IconSlot({ icon, iconProps, className: slotClassN
|
|
|
29
26
|
if (!icon) return null;
|
|
30
27
|
const { className: iconPropsClassName, ...props } = iconProps || {};
|
|
31
28
|
const mergedClassName = cx(slotClassName, iconPropsClassName);
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const svgIcon = icon;
|
|
30
|
+
if (svgIcon.metadata?.isSvgIcon) return /* @__PURE__ */ jsx(Icon, {
|
|
31
|
+
name: svgIcon,
|
|
34
32
|
...props,
|
|
35
33
|
...rest,
|
|
36
34
|
className: mergedClassName
|
|
37
35
|
});
|
|
38
|
-
if (
|
|
36
|
+
if (isFunction(icon)) {
|
|
39
37
|
const iconEl = icon(iconProps || {});
|
|
40
|
-
if (isIconDefinition(iconEl)) return /* @__PURE__ */ jsx(Icon, {
|
|
41
|
-
name: iconEl,
|
|
42
|
-
...props,
|
|
43
|
-
...rest,
|
|
44
|
-
className: mergedClassName
|
|
45
|
-
});
|
|
46
|
-
if (isIconRenderOutput(iconEl)) return /* @__PURE__ */ jsx(Icon, {
|
|
47
|
-
name: icon,
|
|
48
|
-
...props,
|
|
49
|
-
...rest,
|
|
50
|
-
className: mergedClassName
|
|
51
|
-
});
|
|
52
38
|
const elProps = iconEl?.props;
|
|
53
39
|
return isValidElement(iconEl) && cloneElement(iconEl, {
|
|
54
40
|
...rest,
|
|
55
41
|
className: cx(mergedClassName, elProps?.className)
|
|
56
42
|
});
|
|
57
43
|
}
|
|
58
|
-
if (isIconRenderOutput(icon)) return /* @__PURE__ */ jsx(Icon, {
|
|
59
|
-
name: ((svgIconProps) => cloneElement(icon, svgIconProps)),
|
|
60
|
-
...props,
|
|
61
|
-
...rest,
|
|
62
|
-
className: mergedClassName
|
|
63
|
-
});
|
|
64
44
|
const elProps = icon.props;
|
|
65
45
|
return isValidElement(icon) && cloneElement(icon, {
|
|
66
46
|
...props,
|
package/dist/components/Link.cjs
CHANGED
|
@@ -35,7 +35,9 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
35
|
* <Link href="https://yahoo.com" target="_blank" endIcon={LinkIcon} />
|
|
36
36
|
*```
|
|
37
37
|
**/
|
|
38
|
-
const Link = (0, react.forwardRef)(function Input({ variant = "primary", textVariant, startIcon, endIcon, alwaysUnderline = false, children, className, ...anchorProps }, ref) {
|
|
38
|
+
const Link = (0, react.forwardRef)(function Input({ variant = "primary", textVariant, startIcon, endIcon, alwaysUnderline = false, children, className, slotProps, ...anchorProps }, ref) {
|
|
39
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
40
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
39
41
|
const shouldSizeRelativeToContainingText = !textVariant;
|
|
40
42
|
const rootClasses = (0, react.useMemo)(() => {
|
|
41
43
|
return require_styles_styler.getStyles({
|
|
@@ -78,17 +80,22 @@ const Link = (0, react.forwardRef)(function Input({ variant = "primary", textVar
|
|
|
78
80
|
...anchorProps,
|
|
79
81
|
children: [
|
|
80
82
|
startIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
81
|
-
className: iconStartStyles,
|
|
83
|
+
className: require_styles_styler.cx(iconStartStyles, startIconClassName),
|
|
82
84
|
icon: startIcon,
|
|
83
85
|
iconProps,
|
|
84
|
-
"data-testid": "start-icon"
|
|
86
|
+
"data-testid": "start-icon",
|
|
87
|
+
...startIconSlotProps
|
|
85
88
|
}),
|
|
86
|
-
|
|
89
|
+
slotProps?.text ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
90
|
+
...slotProps.text,
|
|
91
|
+
children
|
|
92
|
+
}) : children,
|
|
87
93
|
endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
88
|
-
className: iconEndStyles,
|
|
94
|
+
className: require_styles_styler.cx(iconEndStyles, endIconClassName),
|
|
89
95
|
icon: endIcon,
|
|
90
96
|
iconProps,
|
|
91
|
-
"data-testid": "end-icon"
|
|
97
|
+
"data-testid": "end-icon",
|
|
98
|
+
...endIconSlotProps
|
|
92
99
|
})
|
|
93
100
|
]
|
|
94
101
|
});
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalLinkProps } from "../types/
|
|
2
|
+
import { UniversalLinkProps } from "../types/dist/index.cjs";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../tokens/types.cjs";
|
|
3
4
|
import "../tokens/index.cjs";
|
|
4
5
|
import * as react from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/components/Link.d.ts
|
|
7
8
|
type HTMLAnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
8
12
|
interface LinkProps extends HTMLAnchorProps, UniversalLinkProps {
|
|
9
13
|
/** The link's destination. */
|
|
10
14
|
href?: string;
|
|
11
15
|
/** Anchor rel property. @default "noopener" **/
|
|
12
16
|
rel?: string;
|
|
17
|
+
/** Props to be passed into various slots within the component. */
|
|
18
|
+
slotProps?: {
|
|
19
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
20
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
21
|
+
text?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
/**
|
|
15
25
|
* A Link provides navigation or actionable functionality by linking users to
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalLinkProps } from "../types/
|
|
2
|
+
import { UniversalLinkProps } from "../types/dist/index.js";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../tokens/types.js";
|
|
3
4
|
import "../tokens/index.js";
|
|
4
5
|
import * as react from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/components/Link.d.ts
|
|
7
8
|
type HTMLAnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
8
12
|
interface LinkProps extends HTMLAnchorProps, UniversalLinkProps {
|
|
9
13
|
/** The link's destination. */
|
|
10
14
|
href?: string;
|
|
11
15
|
/** Anchor rel property. @default "noopener" **/
|
|
12
16
|
rel?: string;
|
|
17
|
+
/** Props to be passed into various slots within the component. */
|
|
18
|
+
slotProps?: {
|
|
19
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
20
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
21
|
+
text?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
/**
|
|
15
25
|
* A Link provides navigation or actionable functionality by linking users to
|
package/dist/components/Link.js
CHANGED
|
@@ -33,7 +33,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
* <Link href="https://yahoo.com" target="_blank" endIcon={LinkIcon} />
|
|
34
34
|
*```
|
|
35
35
|
**/
|
|
36
|
-
const Link = forwardRef(function Input({ variant = "primary", textVariant, startIcon, endIcon, alwaysUnderline = false, children, className, ...anchorProps }, ref) {
|
|
36
|
+
const Link = forwardRef(function Input({ variant = "primary", textVariant, startIcon, endIcon, alwaysUnderline = false, children, className, slotProps, ...anchorProps }, ref) {
|
|
37
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
38
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
37
39
|
const shouldSizeRelativeToContainingText = !textVariant;
|
|
38
40
|
const rootClasses = useMemo(() => {
|
|
39
41
|
return getStyles({
|
|
@@ -76,17 +78,22 @@ const Link = forwardRef(function Input({ variant = "primary", textVariant, start
|
|
|
76
78
|
...anchorProps,
|
|
77
79
|
children: [
|
|
78
80
|
startIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
79
|
-
className: iconStartStyles,
|
|
81
|
+
className: cx(iconStartStyles, startIconClassName),
|
|
80
82
|
icon: startIcon,
|
|
81
83
|
iconProps,
|
|
82
|
-
"data-testid": "start-icon"
|
|
84
|
+
"data-testid": "start-icon",
|
|
85
|
+
...startIconSlotProps
|
|
83
86
|
}),
|
|
84
|
-
|
|
87
|
+
slotProps?.text ? /* @__PURE__ */ jsx("span", {
|
|
88
|
+
...slotProps.text,
|
|
89
|
+
children
|
|
90
|
+
}) : children,
|
|
85
91
|
endIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
86
|
-
className: iconEndStyles,
|
|
92
|
+
className: cx(iconEndStyles, endIconClassName),
|
|
87
93
|
icon: endIcon,
|
|
88
94
|
iconProps,
|
|
89
|
-
"data-testid": "end-icon"
|
|
95
|
+
"data-testid": "end-icon",
|
|
96
|
+
...endIconSlotProps
|
|
90
97
|
})
|
|
91
98
|
]
|
|
92
99
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalAvatarIconProps } from "../../../types/
|
|
2
|
+
import { UniversalAvatarIconProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import { IconPropsWithSVGProps } from "../../../tokens/types.cjs";
|
|
4
4
|
import "../../../tokens/index.cjs";
|
|
5
5
|
import * as react from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalAvatarIconProps } from "../../../types/
|
|
3
|
+
import { UniversalAvatarIconProps } from "../../../types/dist/index.js";
|
|
4
4
|
import { IconPropsWithSVGProps } from "../../../tokens/types.js";
|
|
5
5
|
import "../../../tokens/index.js";
|
|
6
6
|
import * as react from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { ImagePropsWithImgProps } from "../../../types/
|
|
2
|
+
import { ImagePropsWithImgProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import { UniversalAvatarImageProps } from "../../../tokens/types.cjs";
|
|
4
4
|
import "../../../tokens/index.cjs";
|
|
5
5
|
import { AvatarIconProps } from "./AvatarIcon.cjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { ImagePropsWithImgProps } from "../../../types/
|
|
3
|
+
import { ImagePropsWithImgProps } from "../../../types/dist/index.js";
|
|
4
4
|
import { UniversalAvatarImageProps } from "../../../tokens/types.js";
|
|
5
5
|
import "../../../tokens/index.js";
|
|
6
6
|
import { AvatarIconProps } from "./AvatarIcon.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalAvatarTextProps } from "../../../types/
|
|
3
|
+
import { UniversalAvatarTextProps } from "../../../types/dist/index.js";
|
|
4
4
|
import "../../../tokens/index.js";
|
|
5
5
|
import { TextProps } from "../../Text.js";
|
|
6
6
|
import * as react from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "../../../types/
|
|
2
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import "../../../tokens/index.cjs";
|
|
4
4
|
import { getStyles } from "../../../styles/styler.cjs";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "../../../types/
|
|
3
|
+
import { AvatarAbbreviationStrategy, AvatarSize, AvatarVariant, UniversalAvatarProps } from "../../../types/dist/index.js";
|
|
4
4
|
import "../../../tokens/index.js";
|
|
5
5
|
import { getStyles } from "../../../styles/styler.js";
|
|
6
6
|
|
|
@@ -40,7 +40,10 @@ const MAX_WIDTH_DEFAULT = 200;
|
|
|
40
40
|
*
|
|
41
41
|
* @related [Chip](https://uds.build/docs/components/chip).
|
|
42
42
|
**/
|
|
43
|
-
const Badge = (0, react.forwardRef)(function Badge({ variant = "primary", size = "md", minWidth, maxWidth = MAX_WIDTH_DEFAULT, startIcon, endIcon, backgroundColor, color, iconColor, borderColor, children, className, ...rest }, ref) {
|
|
43
|
+
const Badge = (0, react.forwardRef)(function Badge({ variant = "primary", size = "md", minWidth, maxWidth = MAX_WIDTH_DEFAULT, startIcon, endIcon, backgroundColor, color, iconColor, borderColor, children, className, slotProps, ...rest }, ref) {
|
|
44
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
45
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
46
|
+
const { className: textClassName, ...textSlotProps } = slotProps?.text ?? {};
|
|
44
47
|
const rootStyles = require_styles_styler.getStyles({
|
|
45
48
|
badgeSizeRoot: size,
|
|
46
49
|
badgeVariantRoot: variant,
|
|
@@ -86,17 +89,20 @@ const Badge = (0, react.forwardRef)(function Badge({ variant = "primary", size =
|
|
|
86
89
|
icon: startIcon,
|
|
87
90
|
iconProps,
|
|
88
91
|
"data-testid": "start-icon",
|
|
89
|
-
className: iconStyles
|
|
92
|
+
className: require_styles_styler.cx(iconStyles, startIconClassName),
|
|
93
|
+
...startIconSlotProps
|
|
90
94
|
}),
|
|
91
95
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
92
|
-
className: "flex-1 truncate whitespace-nowrap text-center",
|
|
96
|
+
className: require_styles_styler.cx("flex-1 truncate whitespace-nowrap text-center", textClassName),
|
|
97
|
+
...textSlotProps,
|
|
93
98
|
children
|
|
94
99
|
}),
|
|
95
100
|
endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
96
101
|
icon: endIcon,
|
|
97
102
|
iconProps,
|
|
98
103
|
"data-testid": "end-icon",
|
|
99
|
-
className: iconStyles
|
|
104
|
+
className: require_styles_styler.cx(iconStyles, endIconClassName),
|
|
105
|
+
...endIconSlotProps
|
|
100
106
|
})
|
|
101
107
|
]
|
|
102
108
|
});
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalBadgeProps } from "../../types/
|
|
2
|
+
import { UniversalBadgeProps } from "../../types/dist/index.cjs";
|
|
3
3
|
import "../../tokens/index.cjs";
|
|
4
|
+
import { IconSlotProps } from "../IconSlot.cjs";
|
|
4
5
|
import React from "react";
|
|
5
6
|
|
|
6
7
|
//#region src/components/client/Badge.d.ts
|
|
7
8
|
type HtmlDivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
8
|
-
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface BadgeProps extends HtmlDivProps, UniversalBadgeProps {
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
startIcon?: Partial<IconSlotProps & DataAttributes>;
|
|
16
|
+
endIcon?: Partial<IconSlotProps & DataAttributes>;
|
|
17
|
+
text?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
9
20
|
/**
|
|
10
21
|
* **⚙️️ A badge.
|
|
11
22
|
*
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalBadgeProps } from "../../types/
|
|
3
|
+
import { UniversalBadgeProps } from "../../types/dist/index.js";
|
|
4
4
|
import "../../tokens/index.js";
|
|
5
|
+
import { IconSlotProps } from "../IconSlot.js";
|
|
5
6
|
import React from "react";
|
|
6
7
|
|
|
7
8
|
//#region src/components/client/Badge.d.ts
|
|
8
9
|
type HtmlDivProps = React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
-
|
|
10
|
+
type DataAttributes = {
|
|
11
|
+
[name: `data-${string}`]: string;
|
|
12
|
+
};
|
|
13
|
+
interface BadgeProps extends HtmlDivProps, UniversalBadgeProps {
|
|
14
|
+
/** Props to be passed into various slots within the component. */
|
|
15
|
+
slotProps?: {
|
|
16
|
+
startIcon?: Partial<IconSlotProps & DataAttributes>;
|
|
17
|
+
endIcon?: Partial<IconSlotProps & DataAttributes>;
|
|
18
|
+
text?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
10
21
|
/**
|
|
11
22
|
* **⚙️️ A badge.
|
|
12
23
|
*
|
|
@@ -37,7 +37,10 @@ const MAX_WIDTH_DEFAULT = 200;
|
|
|
37
37
|
*
|
|
38
38
|
* @related [Chip](https://uds.build/docs/components/chip).
|
|
39
39
|
**/
|
|
40
|
-
const Badge = forwardRef(function Badge({ variant = "primary", size = "md", minWidth, maxWidth = MAX_WIDTH_DEFAULT, startIcon, endIcon, backgroundColor, color, iconColor, borderColor, children, className, ...rest }, ref) {
|
|
40
|
+
const Badge = forwardRef(function Badge({ variant = "primary", size = "md", minWidth, maxWidth = MAX_WIDTH_DEFAULT, startIcon, endIcon, backgroundColor, color, iconColor, borderColor, children, className, slotProps, ...rest }, ref) {
|
|
41
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
42
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
43
|
+
const { className: textClassName, ...textSlotProps } = slotProps?.text ?? {};
|
|
41
44
|
const rootStyles = getStyles({
|
|
42
45
|
badgeSizeRoot: size,
|
|
43
46
|
badgeVariantRoot: variant,
|
|
@@ -83,17 +86,20 @@ const Badge = forwardRef(function Badge({ variant = "primary", size = "md", minW
|
|
|
83
86
|
icon: startIcon,
|
|
84
87
|
iconProps,
|
|
85
88
|
"data-testid": "start-icon",
|
|
86
|
-
className: iconStyles
|
|
89
|
+
className: cx(iconStyles, startIconClassName),
|
|
90
|
+
...startIconSlotProps
|
|
87
91
|
}),
|
|
88
92
|
/* @__PURE__ */ jsx("span", {
|
|
89
|
-
className: "flex-1 truncate whitespace-nowrap text-center",
|
|
93
|
+
className: cx("flex-1 truncate whitespace-nowrap text-center", textClassName),
|
|
94
|
+
...textSlotProps,
|
|
90
95
|
children
|
|
91
96
|
}),
|
|
92
97
|
endIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
93
98
|
icon: endIcon,
|
|
94
99
|
iconProps,
|
|
95
100
|
"data-testid": "end-icon",
|
|
96
|
-
className: iconStyles
|
|
101
|
+
className: cx(iconStyles, endIconClassName),
|
|
102
|
+
...endIconSlotProps
|
|
97
103
|
})
|
|
98
104
|
]
|
|
99
105
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalBottomSheetProps } from "../../../types/
|
|
2
|
+
import { UniversalBottomSheetProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import { BottomSheetController } from "./useBottomSheetStore.cjs";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalBottomSheetProps } from "../../../types/
|
|
3
|
+
import { UniversalBottomSheetProps } from "../../../types/dist/index.js";
|
|
4
4
|
import { BottomSheetController } from "./useBottomSheetStore.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalBottomSheetContentProps } from "../../../types/
|
|
2
|
+
import { UniversalBottomSheetContentProps } from "../../../types/dist/index.cjs";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/client/BottomSheet/BottomSheetContent.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalBottomSheetContentProps } from "../../../types/
|
|
3
|
+
import { UniversalBottomSheetContentProps } from "../../../types/dist/index.js";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/client/BottomSheet/BottomSheetContent.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { BottomSheetVariant } from "../../../types/
|
|
3
|
+
import { BottomSheetVariant } from "../../../types/dist/index.js";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/components/client/BottomSheet/BottomSheetHandle.d.ts
|