@yahoo/uds 3.131.0 → 3.132.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/components/Banner/Banner.cjs +5 -2
- package/dist/components/Banner/Banner.d.cts +9 -0
- package/dist/components/Banner/Banner.d.ts +9 -0
- package/dist/components/Banner/Banner.js +5 -2
- 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 +10 -4
- package/dist/components/Divider/DividerCore.d.ts +10 -4
- package/dist/components/Divider/DividerCore.js +17 -10
- package/dist/components/Divider/DividerInternal.cjs +15 -11
- package/dist/components/Divider/DividerInternal.js +15 -11
- package/dist/components/Link.cjs +13 -6
- package/dist/components/Link.d.cts +10 -0
- package/dist/components/Link.d.ts +10 -0
- package/dist/components/Link.js +13 -6
- package/dist/components/client/Badge.cjs +10 -4
- package/dist/components/client/Badge.d.cts +12 -1
- package/dist/components/client/Badge.d.ts +12 -1
- package/dist/components/client/Badge.js +10 -4
- package/dist/components/client/Button.cjs +20 -9
- package/dist/components/client/Button.d.cts +12 -1
- package/dist/components/client/Button.d.ts +12 -1
- package/dist/components/client/Button.js +20 -9
- package/dist/components/client/Checkbox.cjs +14 -6
- package/dist/components/client/Checkbox.d.cts +9 -4
- package/dist/components/client/Checkbox.d.ts +9 -4
- 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/IconButton.cjs +4 -2
- package/dist/components/client/IconButton.d.cts +10 -2
- package/dist/components/client/IconButton.d.ts +10 -2
- package/dist/components/client/IconButton.js +4 -2
- package/dist/components/client/Input/Input.cjs +16 -6
- package/dist/components/client/Input/Input.d.cts +3 -0
- package/dist/components/client/Input/Input.d.ts +3 -0
- package/dist/components/client/Input/Input.js +17 -7
- package/dist/components/client/Input/InputHelpTextInternal.cjs +16 -6
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +10 -0
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +10 -0
- 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 +7 -0
- package/dist/components/client/Menu/Menu.Content.d.ts +7 -0
- 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 +11 -0
- package/dist/components/client/Menu/Menu.Item.d.ts +11 -0
- 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 +9 -5
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +9 -5
- 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 +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.js +10 -10
- package/dist/components/client/Popover/PopoverContent.cjs +4 -1
- package/dist/components/client/Popover/PopoverContent.d.cts +3 -0
- package/dist/components/client/Popover/PopoverContent.d.ts +3 -0
- package/dist/components/client/Popover/PopoverContent.js +4 -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/Radio/Radio.cjs +18 -15
- package/dist/components/client/Radio/Radio.d.cts +9 -4
- package/dist/components/client/Radio/Radio.d.ts +9 -4
- package/dist/components/client/Radio/Radio.js +18 -15
- package/dist/components/client/Switch.cjs +14 -6
- package/dist/components/client/Switch.d.cts +9 -5
- package/dist/components/client/Switch.d.ts +9 -5
- 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/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/components/client/Tooltip/TooltipContent.cjs +9 -3
- package/dist/components/client/Tooltip/TooltipContent.d.cts +14 -2
- package/dist/components/client/Tooltip/TooltipContent.d.ts +14 -2
- package/dist/components/client/Tooltip/TooltipContent.js +9 -3
- package/dist/components/experimental/client/SwitchV2.cjs +14 -6
- package/dist/components/experimental/client/SwitchV2.d.cts +9 -5
- package/dist/components/experimental/client/SwitchV2.d.ts +9 -5
- package/dist/components/experimental/client/SwitchV2.js +14 -6
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles/styler.d.cts +65 -65
- package/dist/styles/styler.d.ts +65 -65
- package/dist/types/dist/index.d.cts +3 -3
- package/dist/types/dist/index.d.ts +3 -3
- package/dist/uds/generated/componentData.cjs +1485 -1482
- package/dist/uds/generated/componentData.js +1485 -1482
- package/dist/uds/generated/tailwindPurge.cjs +73 -73
- package/dist/uds/generated/tailwindPurge.js +73 -73
- package/generated/componentData.json +2039 -2030
- package/generated/tailwindPurge.ts +1 -1
- package/package.json +1 -1
|
@@ -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
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
|
*
|
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
"use client";
|
|
3
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
|
});
|
|
@@ -109,9 +109,12 @@ const defaultSizeIconClass = require_generateDefaultClassName.generateDefaultCla
|
|
|
109
109
|
*
|
|
110
110
|
* @related [Icon](https://uds.build/docs/components/icon), [IconButton](https://uds.build/docs/components/icon-button), [Pressable](https://uds.build/docs/components/pressable)
|
|
111
111
|
**/
|
|
112
|
-
const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, type = "button", className, width, ...rest }, forwardedRef) {
|
|
112
|
+
const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, ...rest }, forwardedRef) {
|
|
113
113
|
const ref = (0, react.useRef)(null);
|
|
114
114
|
(0, react.useImperativeHandle)(forwardedRef, () => ref.current);
|
|
115
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
116
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
117
|
+
const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
|
|
115
118
|
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
116
119
|
const disableMotion = !!disableEffects || !!rest?.disabled;
|
|
117
120
|
const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
|
|
@@ -205,13 +208,14 @@ const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon,
|
|
|
205
208
|
animate: "icon",
|
|
206
209
|
exit: "hide",
|
|
207
210
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
208
|
-
className: styles.icon,
|
|
211
|
+
className: require_styles_styler.cx(styles.icon, startIconClassName),
|
|
209
212
|
icon: startIcon,
|
|
210
213
|
iconProps: {
|
|
211
214
|
size: require_components_client_buttonConstants.buttonIconSvgSize,
|
|
212
215
|
variant: iconVariant,
|
|
213
216
|
color: "current"
|
|
214
|
-
}
|
|
217
|
+
},
|
|
218
|
+
...startIconSlotProps
|
|
215
219
|
})
|
|
216
220
|
})]
|
|
217
221
|
})
|
|
@@ -220,7 +224,9 @@ const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon,
|
|
|
220
224
|
iconVariant,
|
|
221
225
|
loading,
|
|
222
226
|
startIcon,
|
|
223
|
-
startVariant
|
|
227
|
+
startVariant,
|
|
228
|
+
startIconClassName,
|
|
229
|
+
startIconSlotProps
|
|
224
230
|
]);
|
|
225
231
|
const endContent = (0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
226
232
|
className: styles.iconContainer,
|
|
@@ -236,13 +242,14 @@ const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon,
|
|
|
236
242
|
animate: "icon",
|
|
237
243
|
exit: "hide",
|
|
238
244
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
239
|
-
className: styles.icon,
|
|
245
|
+
className: require_styles_styler.cx(styles.icon, endIconClassName),
|
|
240
246
|
icon: endIcon,
|
|
241
247
|
iconProps: {
|
|
242
248
|
size: require_components_client_buttonConstants.buttonIconSvgSize,
|
|
243
249
|
variant: iconVariant,
|
|
244
250
|
color: "current"
|
|
245
|
-
}
|
|
251
|
+
},
|
|
252
|
+
...endIconSlotProps
|
|
246
253
|
})
|
|
247
254
|
})
|
|
248
255
|
})
|
|
@@ -250,7 +257,9 @@ const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon,
|
|
|
250
257
|
endIcon,
|
|
251
258
|
styles,
|
|
252
259
|
iconVariant,
|
|
253
|
-
endVariant
|
|
260
|
+
endVariant,
|
|
261
|
+
endIconClassName,
|
|
262
|
+
endIconSlotProps
|
|
254
263
|
]);
|
|
255
264
|
if (asChild && (0, react.isValidElement)(children)) {
|
|
256
265
|
const childProps = children.props;
|
|
@@ -273,7 +282,8 @@ const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon,
|
|
|
273
282
|
children: (0, react.cloneElement)(children, childProps, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
274
283
|
startContent,
|
|
275
284
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
276
|
-
className: styles.content,
|
|
285
|
+
className: require_styles_styler.cx(styles.content, contentClassName),
|
|
286
|
+
...contentSlotProps,
|
|
277
287
|
children: children.props.children
|
|
278
288
|
}),
|
|
279
289
|
endContent
|
|
@@ -301,7 +311,8 @@ const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon,
|
|
|
301
311
|
children: [
|
|
302
312
|
startContent,
|
|
303
313
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
304
|
-
className: styles.content,
|
|
314
|
+
className: require_styles_styler.cx(styles.content, contentClassName),
|
|
315
|
+
...contentSlotProps,
|
|
305
316
|
children
|
|
306
317
|
}),
|
|
307
318
|
endContent
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { UniversalButtonProps } from "../../types/dist/index.cjs";
|
|
3
|
+
import { IconPropsWithSVGProps } from "../../tokens/types.cjs";
|
|
3
4
|
import "../../tokens/index.cjs";
|
|
4
5
|
import React, { ForwardRefExoticComponent } from "react";
|
|
5
6
|
import { HTMLMotionProps } from "motion/react";
|
|
@@ -40,7 +41,17 @@ declare const loadingMotionVariants: {
|
|
|
40
41
|
};
|
|
41
42
|
};
|
|
42
43
|
type HtmlButtonProps = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
|
43
|
-
|
|
44
|
+
type DataAttributes = {
|
|
45
|
+
[name: `data-${string}`]: string;
|
|
46
|
+
};
|
|
47
|
+
interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
|
|
48
|
+
/** Props to be passed into various slots within the component. */
|
|
49
|
+
slotProps?: {
|
|
50
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
51
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
52
|
+
content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
44
55
|
/**
|
|
45
56
|
* **🖲️ A button element that can be used to trigger an action**
|
|
46
57
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { UniversalButtonProps } from "../../types/dist/index.js";
|
|
4
|
+
import { IconPropsWithSVGProps } from "../../tokens/types.js";
|
|
4
5
|
import "../../tokens/index.js";
|
|
5
6
|
import React, { ForwardRefExoticComponent } from "react";
|
|
6
7
|
import { HTMLMotionProps } from "motion/react";
|
|
@@ -41,7 +42,17 @@ declare const loadingMotionVariants: {
|
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
44
|
type HtmlButtonProps = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
|
44
|
-
|
|
45
|
+
type DataAttributes = {
|
|
46
|
+
[name: `data-${string}`]: string;
|
|
47
|
+
};
|
|
48
|
+
interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
|
|
49
|
+
/** Props to be passed into various slots within the component. */
|
|
50
|
+
slotProps?: {
|
|
51
|
+
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
52
|
+
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
53
|
+
content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
45
56
|
/**
|
|
46
57
|
* **🖲️ A button element that can be used to trigger an action**
|
|
47
58
|
*
|
|
@@ -106,9 +106,12 @@ const defaultSizeIconClass = generateDefaultClassName("button", "size", "icon");
|
|
|
106
106
|
*
|
|
107
107
|
* @related [Icon](https://uds.build/docs/components/icon), [IconButton](https://uds.build/docs/components/icon-button), [Pressable](https://uds.build/docs/components/pressable)
|
|
108
108
|
**/
|
|
109
|
-
const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, type = "button", className, width, ...rest }, forwardedRef) {
|
|
109
|
+
const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, ...rest }, forwardedRef) {
|
|
110
110
|
const ref = useRef(null);
|
|
111
111
|
useImperativeHandle(forwardedRef, () => ref.current);
|
|
112
|
+
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
113
|
+
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
114
|
+
const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
|
|
112
115
|
const prefersReducedMotion = useReducedMotion();
|
|
113
116
|
const disableMotion = !!disableEffects || !!rest?.disabled;
|
|
114
117
|
const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
|
|
@@ -202,13 +205,14 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
202
205
|
animate: "icon",
|
|
203
206
|
exit: "hide",
|
|
204
207
|
children: /* @__PURE__ */ jsx(IconSlot, {
|
|
205
|
-
className: styles.icon,
|
|
208
|
+
className: cx(styles.icon, startIconClassName),
|
|
206
209
|
icon: startIcon,
|
|
207
210
|
iconProps: {
|
|
208
211
|
size: buttonIconSvgSize,
|
|
209
212
|
variant: iconVariant,
|
|
210
213
|
color: "current"
|
|
211
|
-
}
|
|
214
|
+
},
|
|
215
|
+
...startIconSlotProps
|
|
212
216
|
})
|
|
213
217
|
})]
|
|
214
218
|
})
|
|
@@ -217,7 +221,9 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
217
221
|
iconVariant,
|
|
218
222
|
loading,
|
|
219
223
|
startIcon,
|
|
220
|
-
startVariant
|
|
224
|
+
startVariant,
|
|
225
|
+
startIconClassName,
|
|
226
|
+
startIconSlotProps
|
|
221
227
|
]);
|
|
222
228
|
const endContent = useMemo(() => /* @__PURE__ */ jsx(m.span, {
|
|
223
229
|
className: styles.iconContainer,
|
|
@@ -233,13 +239,14 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
233
239
|
animate: "icon",
|
|
234
240
|
exit: "hide",
|
|
235
241
|
children: /* @__PURE__ */ jsx(IconSlot, {
|
|
236
|
-
className: styles.icon,
|
|
242
|
+
className: cx(styles.icon, endIconClassName),
|
|
237
243
|
icon: endIcon,
|
|
238
244
|
iconProps: {
|
|
239
245
|
size: buttonIconSvgSize,
|
|
240
246
|
variant: iconVariant,
|
|
241
247
|
color: "current"
|
|
242
|
-
}
|
|
248
|
+
},
|
|
249
|
+
...endIconSlotProps
|
|
243
250
|
})
|
|
244
251
|
})
|
|
245
252
|
})
|
|
@@ -247,7 +254,9 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
247
254
|
endIcon,
|
|
248
255
|
styles,
|
|
249
256
|
iconVariant,
|
|
250
|
-
endVariant
|
|
257
|
+
endVariant,
|
|
258
|
+
endIconClassName,
|
|
259
|
+
endIconSlotProps
|
|
251
260
|
]);
|
|
252
261
|
if (asChild && isValidElement(children)) {
|
|
253
262
|
const childProps = children.props;
|
|
@@ -270,7 +279,8 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
270
279
|
children: cloneElement(children, childProps, /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
271
280
|
startContent,
|
|
272
281
|
/* @__PURE__ */ jsx("span", {
|
|
273
|
-
className: styles.content,
|
|
282
|
+
className: cx(styles.content, contentClassName),
|
|
283
|
+
...contentSlotProps,
|
|
274
284
|
children: children.props.children
|
|
275
285
|
}),
|
|
276
286
|
endContent
|
|
@@ -298,7 +308,8 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
298
308
|
children: [
|
|
299
309
|
startContent,
|
|
300
310
|
/* @__PURE__ */ jsx("span", {
|
|
301
|
-
className: styles.content,
|
|
311
|
+
className: cx(styles.content, contentClassName),
|
|
312
|
+
...contentSlotProps,
|
|
302
313
|
children
|
|
303
314
|
}),
|
|
304
315
|
endContent
|
|
@@ -58,9 +58,13 @@ const pressTransition = {
|
|
|
58
58
|
*
|
|
59
59
|
* @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
|
|
60
60
|
**/
|
|
61
|
-
const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, disabled, required, hasError, className, style,
|
|
61
|
+
const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, disabled, required, hasError, className, style, slotProps, ...checkboxProps }, parentRef) {
|
|
62
62
|
const generatedId = (0, react.useId)();
|
|
63
63
|
const uid = id ?? `uds-input-${generatedId}`;
|
|
64
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
65
|
+
const checkboxSlotProps = slotProps?.checkbox ?? {};
|
|
66
|
+
const iconSlotProps = slotProps?.icon ?? {};
|
|
67
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
64
68
|
const innerRef = (0, react.useRef)(null);
|
|
65
69
|
/**
|
|
66
70
|
* State
|
|
@@ -138,13 +142,13 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
138
142
|
"cursor-pointer": !disabled,
|
|
139
143
|
"cursor-default": disabled,
|
|
140
144
|
"opacity-50": disabled
|
|
141
|
-
}, className
|
|
145
|
+
}, className)
|
|
142
146
|
}),
|
|
143
147
|
checkbox: require_styles_styler.getStyles({
|
|
144
148
|
checkboxSizeCheckbox: size,
|
|
145
149
|
checkboxVariantCheckbox: variant,
|
|
146
150
|
checkboxVariantValueCheckbox: valueState,
|
|
147
|
-
className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]"
|
|
151
|
+
className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
|
|
148
152
|
}),
|
|
149
153
|
check: require_styles_styler.getStyles({
|
|
150
154
|
checkboxVariantCheckboxIcon: variant,
|
|
@@ -152,7 +156,7 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
152
156
|
className: require_styles_styler.cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
|
|
153
157
|
}),
|
|
154
158
|
htmlCheckbox: require_styles_styler.cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
155
|
-
label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end"
|
|
159
|
+
label: require_styles_styler.cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
156
160
|
};
|
|
157
161
|
const RootElement = label ? motion_react.m.label : motion_react.m.div;
|
|
158
162
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
@@ -168,6 +172,7 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
168
172
|
onTap: handleTapEnd,
|
|
169
173
|
onTapCancel: handleTapEnd,
|
|
170
174
|
tabIndex: -1,
|
|
175
|
+
...rootSlotProps,
|
|
171
176
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
|
|
172
177
|
position: "relative",
|
|
173
178
|
className: classNames.checkbox,
|
|
@@ -175,6 +180,7 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
175
180
|
justifyContent: "center",
|
|
176
181
|
flex: "none",
|
|
177
182
|
animate: motionAnimate,
|
|
183
|
+
...checkboxSlotProps,
|
|
178
184
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
179
185
|
type: "checkbox",
|
|
180
186
|
tabIndex: 0,
|
|
@@ -196,7 +202,8 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
196
202
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
197
203
|
name: getIcon(checked),
|
|
198
204
|
size: "sm",
|
|
199
|
-
className: classNames.check
|
|
205
|
+
className: classNames.check,
|
|
206
|
+
...iconSlotProps
|
|
200
207
|
})]
|
|
201
208
|
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_FormLabel.FormLabel, {
|
|
202
209
|
as: "div",
|
|
@@ -204,7 +211,8 @@ const Checkbox = (0, react.forwardRef)(function Checkbox({ id, checked: checkedP
|
|
|
204
211
|
color: "inherit",
|
|
205
212
|
required,
|
|
206
213
|
label,
|
|
207
|
-
className: classNames.label
|
|
214
|
+
className: classNames.label,
|
|
215
|
+
...labelSlotProps
|
|
208
216
|
})]
|
|
209
217
|
})
|
|
210
218
|
});
|
|
@@ -5,11 +5,16 @@ import React from "react";
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/client/Checkbox.d.ts
|
|
7
7
|
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color'>;
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string;
|
|
10
|
+
};
|
|
8
11
|
interface CheckboxProps extends NativeInputProps, UniversalCheckboxProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/** Props to be passed into various slots within the component. */
|
|
13
|
+
slotProps?: {
|
|
14
|
+
root?: DataAttributes;
|
|
15
|
+
checkbox?: DataAttributes;
|
|
16
|
+
icon?: DataAttributes;
|
|
17
|
+
label?: DataAttributes;
|
|
13
18
|
};
|
|
14
19
|
}
|
|
15
20
|
declare const VARIANTS: ("primary" | "secondary")[];
|
|
@@ -6,11 +6,16 @@ import React from "react";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/client/Checkbox.d.ts
|
|
8
8
|
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'checked' | 'size' | 'height' | 'width' | 'color'>;
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
9
12
|
interface CheckboxProps extends NativeInputProps, UniversalCheckboxProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
root?: DataAttributes;
|
|
16
|
+
checkbox?: DataAttributes;
|
|
17
|
+
icon?: DataAttributes;
|
|
18
|
+
label?: DataAttributes;
|
|
14
19
|
};
|
|
15
20
|
}
|
|
16
21
|
declare const VARIANTS: ("primary" | "secondary")[];
|
|
@@ -55,9 +55,13 @@ const pressTransition = {
|
|
|
55
55
|
*
|
|
56
56
|
* @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
|
|
57
57
|
**/
|
|
58
|
-
const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, disabled, required, hasError, className, style,
|
|
58
|
+
const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaultChecked, onChange, label, labelPosition = "start", variant: variantProp = "primary", size = "md", reduceMotion: forceReduceMotion, disabled, required, hasError, className, style, slotProps, ...checkboxProps }, parentRef) {
|
|
59
59
|
const generatedId = useId();
|
|
60
60
|
const uid = id ?? `uds-input-${generatedId}`;
|
|
61
|
+
const rootSlotProps = slotProps?.root ?? {};
|
|
62
|
+
const checkboxSlotProps = slotProps?.checkbox ?? {};
|
|
63
|
+
const iconSlotProps = slotProps?.icon ?? {};
|
|
64
|
+
const labelSlotProps = slotProps?.label ?? {};
|
|
61
65
|
const innerRef = useRef(null);
|
|
62
66
|
/**
|
|
63
67
|
* State
|
|
@@ -135,13 +139,13 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
135
139
|
"cursor-pointer": !disabled,
|
|
136
140
|
"cursor-default": disabled,
|
|
137
141
|
"opacity-50": disabled
|
|
138
|
-
}, className
|
|
142
|
+
}, className)
|
|
139
143
|
}),
|
|
140
144
|
checkbox: getStyles({
|
|
141
145
|
checkboxSizeCheckbox: size,
|
|
142
146
|
checkboxVariantCheckbox: variant,
|
|
143
147
|
checkboxVariantValueCheckbox: valueState,
|
|
144
|
-
className: cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]"
|
|
148
|
+
className: cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
|
|
145
149
|
}),
|
|
146
150
|
check: getStyles({
|
|
147
151
|
checkboxVariantCheckboxIcon: variant,
|
|
@@ -149,7 +153,7 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
149
153
|
className: cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
|
|
150
154
|
}),
|
|
151
155
|
htmlCheckbox: cx("cursor-[inherit]", "absolute", "opacity-0", "top-1/2", "left-1/2", "w-[calc(100%+2px)]", "h-[calc(100%+2px)]", "transform", "translate-x-[-50%]", "translate-y-[-50%]"),
|
|
152
|
-
label: cx(labelPosition === "start" ? "text-start" : "text-end"
|
|
156
|
+
label: cx(labelPosition === "start" ? "text-start" : "text-end")
|
|
153
157
|
};
|
|
154
158
|
const RootElement = label ? m.label : m.div;
|
|
155
159
|
return /* @__PURE__ */ jsx(SpringMotionConfig, {
|
|
@@ -165,6 +169,7 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
165
169
|
onTap: handleTapEnd,
|
|
166
170
|
onTapCancel: handleTapEnd,
|
|
167
171
|
tabIndex: -1,
|
|
172
|
+
...rootSlotProps,
|
|
168
173
|
children: [/* @__PURE__ */ jsxs(MotionBox, {
|
|
169
174
|
position: "relative",
|
|
170
175
|
className: classNames.checkbox,
|
|
@@ -172,6 +177,7 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
172
177
|
justifyContent: "center",
|
|
173
178
|
flex: "none",
|
|
174
179
|
animate: motionAnimate,
|
|
180
|
+
...checkboxSlotProps,
|
|
175
181
|
children: [/* @__PURE__ */ jsx("input", {
|
|
176
182
|
type: "checkbox",
|
|
177
183
|
tabIndex: 0,
|
|
@@ -193,7 +199,8 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
193
199
|
}), /* @__PURE__ */ jsx(Icon, {
|
|
194
200
|
name: getIcon(checked),
|
|
195
201
|
size: "sm",
|
|
196
|
-
className: classNames.check
|
|
202
|
+
className: classNames.check,
|
|
203
|
+
...iconSlotProps
|
|
197
204
|
})]
|
|
198
205
|
}), label && /* @__PURE__ */ jsx(FormLabel, {
|
|
199
206
|
as: "div",
|
|
@@ -201,7 +208,8 @@ const Checkbox = forwardRef(function Checkbox({ id, checked: checkedProp, defaul
|
|
|
201
208
|
color: "inherit",
|
|
202
209
|
required,
|
|
203
210
|
label,
|
|
204
|
-
className: classNames.label
|
|
211
|
+
className: classNames.label,
|
|
212
|
+
...labelSlotProps
|
|
205
213
|
})]
|
|
206
214
|
})
|
|
207
215
|
});
|
|
@@ -8,7 +8,7 @@ import React from "react";
|
|
|
8
8
|
type HtmlDivProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onToggle' | 'label'>;
|
|
9
9
|
interface ChipProps extends UniversalChipProps, HtmlDivProps {
|
|
10
10
|
slotProps?: ChipBaseProps['slotProps'] & {
|
|
11
|
-
anchor
|
|
11
|
+
anchor?: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'>;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -9,7 +9,7 @@ import React from "react";
|
|
|
9
9
|
type HtmlDivProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onToggle' | 'label'>;
|
|
10
10
|
interface ChipProps extends UniversalChipProps, HtmlDivProps {
|
|
11
11
|
slotProps?: ChipBaseProps['slotProps'] & {
|
|
12
|
-
anchor
|
|
12
|
+
anchor?: Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'>;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
@@ -45,9 +45,10 @@ const defaultVariantIconClass = require_generateDefaultClassName.generateDefault
|
|
|
45
45
|
* @related [Icon](https://uds.build/docs/components/icon), [Button](https://uds.build/docs/components/button), and [Pressable](https://uds.build/docs/components/pressable)
|
|
46
46
|
*
|
|
47
47
|
**/
|
|
48
|
-
const IconButton = (0, react.forwardRef)(function IconButton({ variant, size, iconVariant, loading, disableEffects, name, type = "button", htmlName, className, children, ...rest }, forwardedRef) {
|
|
48
|
+
const IconButton = (0, react.forwardRef)(function IconButton({ variant, size, iconVariant, loading, disableEffects, name, slotProps, type = "button", htmlName, className, children, ...rest }, forwardedRef) {
|
|
49
49
|
const ref = (0, react.useRef)(null);
|
|
50
50
|
(0, react.useImperativeHandle)(forwardedRef, () => ref.current);
|
|
51
|
+
const { className: iconSlotClassName, ...iconSlotProps } = slotProps?.icon ?? {};
|
|
51
52
|
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
52
53
|
const disableMotion = !!disableEffects || !!rest?.disabled;
|
|
53
54
|
const layoutVariant = (0, react.useMemo)(() => prefersReducedMotion ? "smooth" : "subtle", [prefersReducedMotion]);
|
|
@@ -117,7 +118,8 @@ const IconButton = (0, react.forwardRef)(function IconButton({ variant, size, ic
|
|
|
117
118
|
name,
|
|
118
119
|
variant: iconVariant,
|
|
119
120
|
color: "current",
|
|
120
|
-
className: styles.icon
|
|
121
|
+
className: require_styles_styler.cx(styles.icon, iconSlotClassName),
|
|
122
|
+
...iconSlotProps
|
|
121
123
|
})
|
|
122
124
|
}, name.name)]
|
|
123
125
|
})
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalIconButtonProps } from "../../tokens/types.cjs";
|
|
2
|
+
import { IconPropsWithSVGProps, UniversalIconButtonProps } from "../../tokens/types.cjs";
|
|
3
3
|
import "../../tokens/index.cjs";
|
|
4
4
|
import * as react from "react";
|
|
5
5
|
import { HTMLMotionProps } from "motion/react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/client/IconButton.d.ts
|
|
8
8
|
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
|
|
9
|
-
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string;
|
|
11
|
+
};
|
|
12
|
+
interface IconButtonProps extends HtmlButtonProps, UniversalIconButtonProps {
|
|
13
|
+
/** Props to be passed into various slots within the component. */
|
|
14
|
+
slotProps?: {
|
|
15
|
+
icon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
12
20
|
*
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
"use client";
|
|
3
|
-
import { UniversalIconButtonProps } from "../../tokens/types.js";
|
|
3
|
+
import { IconPropsWithSVGProps, UniversalIconButtonProps } from "../../tokens/types.js";
|
|
4
4
|
import "../../tokens/index.js";
|
|
5
5
|
import * as react from "react";
|
|
6
6
|
import { HTMLMotionProps } from "motion/react";
|
|
7
7
|
|
|
8
8
|
//#region src/components/client/IconButton.d.ts
|
|
9
9
|
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'> & Omit<HTMLMotionProps<'button'>, 'name'>;
|
|
10
|
-
|
|
10
|
+
type DataAttributes = {
|
|
11
|
+
[name: `data-${string}`]: string;
|
|
12
|
+
};
|
|
13
|
+
interface IconButtonProps extends HtmlButtonProps, UniversalIconButtonProps {
|
|
14
|
+
/** Props to be passed into various slots within the component. */
|
|
15
|
+
slotProps?: {
|
|
16
|
+
icon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
11
19
|
/**
|
|
12
20
|
* **⚙️️ An icon button element that can be used to trigger an action**
|
|
13
21
|
*
|