@yahoo/uds 3.159.2 → 3.161.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.cjs +1 -1
- package/dist/automated-config/dist/properties.js +1 -1
- package/dist/components/client/BottomSheet/BottomSheet.cjs +2 -2
- package/dist/components/client/BottomSheet/BottomSheet.js +2 -2
- package/dist/components/client/Button/Button.cjs +214 -0
- package/dist/components/client/Button/Button.d.cts +50 -0
- package/dist/components/client/Button/Button.d.ts +51 -0
- package/dist/components/client/Button/Button.js +209 -0
- package/dist/components/client/Button/ButtonBase.cjs +120 -0
- package/dist/components/client/Button/ButtonBase.d.cts +52 -0
- package/dist/components/client/Button/ButtonBase.d.ts +53 -0
- package/dist/components/client/Button/ButtonBase.js +116 -0
- package/dist/components/client/{buttonConstants.cjs → Button/buttonConstants.cjs} +1 -1
- package/dist/components/client/Button/buttonConstants.d.cts +7 -0
- package/dist/components/client/Button/buttonConstants.d.ts +8 -0
- package/dist/components/client/{buttonConstants.js → Button/buttonConstants.js} +1 -1
- package/dist/components/client/Button/index.cjs +10 -0
- package/dist/components/client/Button/index.d.cts +4 -0
- package/dist/components/client/Button/index.d.ts +5 -0
- package/dist/components/client/Button/index.js +5 -0
- package/dist/components/client/Checkbox.cjs +2 -1
- package/dist/components/client/Checkbox.js +3 -2
- package/dist/components/client/Chip/ChipBase.cjs +2 -2
- package/dist/components/client/Chip/ChipBase.js +2 -2
- package/dist/components/client/IconButton/IconButton.cjs +105 -0
- package/dist/components/client/IconButton/IconButton.d.cts +17 -0
- package/dist/components/client/IconButton/IconButton.d.ts +18 -0
- package/dist/components/client/IconButton/IconButton.js +103 -0
- package/dist/components/client/IconButton/IconButtonBase.cjs +68 -0
- package/dist/components/client/IconButton/IconButtonBase.d.cts +45 -0
- package/dist/components/client/IconButton/IconButtonBase.d.ts +46 -0
- package/dist/components/client/IconButton/IconButtonBase.js +65 -0
- package/dist/components/client/IconButton/index.cjs +8 -0
- package/dist/components/client/IconButton/index.d.cts +4 -0
- package/dist/components/client/IconButton/index.d.ts +5 -0
- package/dist/components/client/IconButton/index.js +5 -0
- package/dist/components/client/Input/Input.cjs +2 -2
- package/dist/components/client/Input/Input.js +2 -2
- package/dist/components/client/Modal/ManagedModal.cjs +2 -2
- package/dist/components/client/Modal/ManagedModal.js +2 -2
- package/dist/components/client/Modal/Modal.cjs +2 -2
- package/dist/components/client/Modal/Modal.js +2 -2
- package/dist/components/client/Popover/Popover.cjs +2 -2
- package/dist/components/client/Popover/Popover.js +2 -2
- package/dist/components/client/Radio/Radio.cjs +2 -1
- package/dist/components/client/Radio/Radio.js +3 -2
- package/dist/components/client/SpringMotionConfig.cjs +10 -13
- package/dist/components/client/SpringMotionConfig.js +10 -13
- package/dist/components/client/Switch/Switch.cjs +119 -0
- package/dist/components/client/{Switch.d.cts → Switch/Switch.d.cts} +4 -16
- package/dist/components/client/{Switch.d.ts → Switch/Switch.d.ts} +4 -16
- package/dist/components/client/Switch/Switch.js +115 -0
- package/dist/components/client/Switch/SwitchBase.cjs +129 -0
- package/dist/components/client/Switch/SwitchBase.d.cts +29 -0
- package/dist/components/client/Switch/SwitchBase.d.ts +30 -0
- package/dist/components/client/Switch/SwitchBase.js +126 -0
- package/dist/components/client/Switch/index.cjs +5 -0
- package/dist/components/client/Switch/index.d.cts +3 -0
- package/dist/components/client/Switch/index.d.ts +4 -0
- package/dist/components/client/Switch/index.js +4 -0
- package/dist/components/client/Switch/switchStyles.cjs +17 -0
- package/dist/components/client/Switch/switchStyles.d.cts +9 -0
- package/dist/components/client/Switch/switchStyles.d.ts +10 -0
- package/dist/components/client/Switch/switchStyles.js +16 -0
- package/dist/components/client/Switch/types.cjs +2 -0
- package/dist/components/client/Switch/types.d.cts +33 -0
- package/dist/components/client/Switch/types.d.ts +34 -0
- package/dist/components/client/Switch/types.js +2 -0
- package/dist/components/client/Tabs/TabList.cjs +2 -2
- package/dist/components/client/Tabs/TabList.js +2 -2
- package/dist/components/client/Toast/Toast.cjs +4 -4
- 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/Toast.js +3 -3
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +1 -1
- package/dist/components/client/index.cjs +6 -6
- package/dist/components/client/index.d.cts +3 -3
- package/dist/components/client/index.d.ts +3 -3
- package/dist/components/client/index.js +3 -3
- package/dist/components/experimental/client/index.cjs +0 -6
- package/dist/components/experimental/client/index.d.cts +1 -3
- package/dist/components/experimental/client/index.d.ts +1 -3
- package/dist/components/experimental/client/index.js +1 -3
- package/dist/components/experimental/index.cjs +0 -5
- package/dist/components/experimental/index.d.cts +1 -3
- package/dist/components/experimental/index.d.ts +1 -3
- package/dist/components/experimental/index.js +1 -3
- package/dist/components/index.cjs +6 -6
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +3 -3
- package/dist/css-animation/Button/Button.cjs +85 -0
- package/dist/css-animation/Button/Button.d.cts +13 -0
- package/dist/css-animation/Button/Button.d.ts +14 -0
- package/dist/css-animation/Button/Button.js +82 -0
- package/dist/css-animation/Button/index.cjs +5 -0
- package/dist/css-animation/Button/index.d.cts +4 -0
- package/dist/css-animation/Button/index.d.ts +5 -0
- package/dist/css-animation/Button/index.js +4 -0
- package/dist/css-animation/IconButton/IconButton.cjs +55 -0
- package/dist/css-animation/IconButton/IconButton.d.cts +13 -0
- package/dist/css-animation/IconButton/IconButton.d.ts +14 -0
- package/dist/css-animation/IconButton/IconButton.js +53 -0
- package/dist/css-animation/IconButton/index.cjs +5 -0
- package/dist/css-animation/IconButton/index.d.cts +4 -0
- package/dist/css-animation/IconButton/index.d.ts +5 -0
- package/dist/css-animation/IconButton/index.js +4 -0
- package/dist/css-animation/Switch/Switch.cjs +44 -0
- package/dist/css-animation/Switch/Switch.d.cts +22 -0
- package/dist/css-animation/Switch/Switch.d.ts +23 -0
- package/dist/css-animation/Switch/Switch.js +41 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.cjs +56 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.d.cts +31 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.d.ts +32 -0
- package/dist/css-animation/Switch/SwitchStaticHandle.js +54 -0
- package/dist/css-animation/Switch/index.cjs +5 -0
- package/dist/css-animation/Switch/index.d.cts +3 -0
- package/dist/css-animation/Switch/index.d.ts +4 -0
- package/dist/css-animation/Switch/index.js +4 -0
- package/dist/css-animation/index.cjs +9 -0
- package/dist/css-animation/index.d.cts +7 -0
- package/dist/css-animation/index.d.ts +8 -0
- package/dist/css-animation/index.js +6 -0
- package/dist/hooks/usePrefersReducedMotion.cjs +36 -0
- package/dist/hooks/usePrefersReducedMotion.d.cts +5 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +5 -0
- package/dist/hooks/usePrefersReducedMotion.js +34 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/styles/styler.d.cts +24 -24
- package/dist/styles/styler.d.ts +24 -24
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/uds/generated/componentData.cjs +372 -381
- package/dist/uds/generated/componentData.js +372 -381
- package/dist/uds/generated/tailwindPurge.cjs +8 -21
- package/dist/uds/generated/tailwindPurge.js +8 -21
- package/dist/uds/package.cjs +12 -2
- package/dist/uds/package.js +12 -2
- package/generated/componentData.json +572 -603
- package/generated/tailwindPurge.ts +3 -3
- package/package.json +13 -3
- package/dist/components/client/Button.cjs +0 -326
- package/dist/components/client/Button.d.cts +0 -86
- package/dist/components/client/Button.d.ts +0 -87
- package/dist/components/client/Button.js +0 -321
- package/dist/components/client/IconButton.cjs +0 -161
- package/dist/components/client/IconButton.d.cts +0 -46
- package/dist/components/client/IconButton.d.ts +0 -47
- package/dist/components/client/IconButton.js +0 -159
- package/dist/components/client/Switch.cjs +0 -225
- package/dist/components/client/Switch.js +0 -222
- package/dist/components/client/buttonConstants.d.cts +0 -7
- package/dist/components/client/buttonConstants.d.ts +0 -8
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.cjs +0 -14
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +0 -8
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +0 -9
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.js +0 -11
- package/dist/components/experimental/client/SwitchV2.cjs +0 -190
- package/dist/components/experimental/client/SwitchV2.d.cts +0 -46
- package/dist/components/experimental/client/SwitchV2.d.ts +0 -47
- package/dist/components/experimental/client/SwitchV2.js +0 -185
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yahoo/uds",
|
|
3
3
|
"description": "Yahoo Universal System",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.161.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -199,6 +199,16 @@
|
|
|
199
199
|
"default": "./dist/runtime/index.cjs"
|
|
200
200
|
}
|
|
201
201
|
},
|
|
202
|
+
"./css-animation": {
|
|
203
|
+
"import": {
|
|
204
|
+
"types": "./dist/css-animation/index.d.ts",
|
|
205
|
+
"default": "./dist/css-animation/index.js"
|
|
206
|
+
},
|
|
207
|
+
"require": {
|
|
208
|
+
"types": "./dist/css-animation/index.d.cts",
|
|
209
|
+
"default": "./dist/css-animation/index.cjs"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
202
212
|
"./__private/motion": {
|
|
203
213
|
"import": {
|
|
204
214
|
"types": "./dist/tokens/configs/motion.d.ts",
|
|
@@ -218,14 +228,14 @@
|
|
|
218
228
|
"dev:fixtures": "bun run ./scripts/buildFixtures.ts --watch",
|
|
219
229
|
"dev:ts": "tsdown --watch",
|
|
220
230
|
"format:pkg": "bun --cwd ../../ syncpack format",
|
|
221
|
-
"generate:componentData": "bun run ../css/scripts/generateComponentData.ts --components-dir src/components --output generated/componentData.json",
|
|
231
|
+
"generate:componentData": "bun run ../css/scripts/generateComponentData.ts --components-dir src/components --components-dir src/css-animation --output generated/componentData.json",
|
|
222
232
|
"generate:purgeCSSData": "cd ../tailwind-v3 && bun run ./scripts/generatePurgeCSSData.ts --tsconfig ../uds/tsconfig.json --variants ../uds/src/styles/variants.ts --components ../uds/src/components/index.ts --experimental-components ../uds/src/components/experimental/index.ts --output ../uds/generated/tailwindPurge.ts",
|
|
223
233
|
"lint": "eslint -c eslint.config.mjs .",
|
|
224
234
|
"lint:fix": "bun run lint --fix",
|
|
225
235
|
"lint:pkg": "bun publint",
|
|
226
236
|
"test": "vitest run",
|
|
227
237
|
"test:coverage": "vitest run --coverage",
|
|
228
|
-
"test:e2e": "bun run e2e/verifyCLI.ts && bun run e2e/enforcePublicImportsAPI.ts",
|
|
238
|
+
"test:e2e": "bun run e2e/verifyCLI.ts && bun run e2e/enforcePublicImportsAPI.ts && bun run e2e/verifyCssAnimationNextBundle.ts",
|
|
229
239
|
"test:ui": "vitest --ui --coverage",
|
|
230
240
|
"test:update": "vitest run -u",
|
|
231
241
|
"test:watch": "vitest",
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
-
const require_index = require("../../css-tokens/dist/index.cjs");
|
|
6
|
-
const require_styles_styler = require("../../styles/styler.cjs");
|
|
7
|
-
const require_utils_createSlot = require("../../utils/createSlot.cjs");
|
|
8
|
-
const require_components_Icon = require("../Icon.cjs");
|
|
9
|
-
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
10
|
-
const require_generateDefaultClassName = require("../../automated-config/dist/utils/generateDefaultClassName.cjs");
|
|
11
|
-
require("./buttonConstants.cjs");
|
|
12
|
-
const require_components_client_SpringMotionConfig = require("./SpringMotionConfig.cjs");
|
|
13
|
-
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
14
|
-
let react = require("react");
|
|
15
|
-
react = require_runtime.__toESM(react);
|
|
16
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
-
let motion_react = require("motion/react");
|
|
18
|
-
//#region src/components/client/Button.tsx
|
|
19
|
-
const iconContainerMotionVariants = {
|
|
20
|
-
hide: {
|
|
21
|
-
display: "none",
|
|
22
|
-
width: "0px",
|
|
23
|
-
opacity: 0
|
|
24
|
-
},
|
|
25
|
-
loading: {
|
|
26
|
-
display: "flex",
|
|
27
|
-
width: "auto",
|
|
28
|
-
opacity: 1
|
|
29
|
-
},
|
|
30
|
-
icon: {
|
|
31
|
-
display: "flex",
|
|
32
|
-
width: "auto",
|
|
33
|
-
opacity: 1
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const SCALE_DOWN = .7;
|
|
37
|
-
const hiddenState = {
|
|
38
|
-
scale: SCALE_DOWN,
|
|
39
|
-
opacity: 0
|
|
40
|
-
};
|
|
41
|
-
const visibleState = {
|
|
42
|
-
scale: [
|
|
43
|
-
SCALE_DOWN,
|
|
44
|
-
SCALE_DOWN,
|
|
45
|
-
1
|
|
46
|
-
],
|
|
47
|
-
opacity: [
|
|
48
|
-
0,
|
|
49
|
-
0,
|
|
50
|
-
1
|
|
51
|
-
],
|
|
52
|
-
transition: { times: [
|
|
53
|
-
0,
|
|
54
|
-
.5,
|
|
55
|
-
1
|
|
56
|
-
] }
|
|
57
|
-
};
|
|
58
|
-
const iconMotionVariants = {
|
|
59
|
-
hide: hiddenState,
|
|
60
|
-
icon: visibleState,
|
|
61
|
-
loading: hiddenState
|
|
62
|
-
};
|
|
63
|
-
const loadingMotionVariants = {
|
|
64
|
-
hide: hiddenState,
|
|
65
|
-
icon: hiddenState,
|
|
66
|
-
loading: visibleState
|
|
67
|
-
};
|
|
68
|
-
function getGapVariant({ startIcon, endIcon, loading }) {
|
|
69
|
-
if (loading || startIcon || endIcon) return "withIcon";
|
|
70
|
-
return "withoutIcon";
|
|
71
|
-
}
|
|
72
|
-
function getStartVariant({ loading, startIcon }) {
|
|
73
|
-
if (loading) return "loading";
|
|
74
|
-
if (startIcon) return "icon";
|
|
75
|
-
return "hide";
|
|
76
|
-
}
|
|
77
|
-
const defaultVariantRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "root");
|
|
78
|
-
const defaultVariantIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "variant", "icon");
|
|
79
|
-
const defaultSizeRootClass = require_generateDefaultClassName.generateDefaultClassName("button", "size", "root");
|
|
80
|
-
const defaultSizeIconClass = require_generateDefaultClassName.generateDefaultClassName("button", "size", "icon");
|
|
81
|
-
/**
|
|
82
|
-
* **🖲️ A button element that can be used to trigger an action**
|
|
83
|
-
*
|
|
84
|
-
* @componentType Client component
|
|
85
|
-
*
|
|
86
|
-
* @description A button is a fundamental component used to trigger an action or event. Buttons are interactive elements that users can click, tap, or otherwise engage with to submit forms, open dialogues, or perform any other interaction within an application or website. Consider an IconButton for buttons that only contain an icon.
|
|
87
|
-
*
|
|
88
|
-
* @see The {@link https://uds.build/docs/components/button Button Docs} for more info
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```tsx
|
|
92
|
-
* 'use client';
|
|
93
|
-
* import { Button, HStack } from "@yahoo/uds";
|
|
94
|
-
*
|
|
95
|
-
* export function Demo() {
|
|
96
|
-
* return (
|
|
97
|
-
* <HStack gap="2">
|
|
98
|
-
* <Button onClick={console.log}>Save</Button>
|
|
99
|
-
* <Button variant="secondary" onClick={console.log}>Cancel</Button>
|
|
100
|
-
* </HStack>
|
|
101
|
-
* )
|
|
102
|
-
* }
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* @usage
|
|
107
|
-
* Buttons should be used to clearly indicate and initiate actions that users can take.
|
|
108
|
-
*
|
|
109
|
-
* @related [Icon](https://uds.build/docs/components/icon), [IconButton](https://uds.build/docs/components/icon-button), [Pressable](https://uds.build/docs/components/pressable)
|
|
110
|
-
**/
|
|
111
|
-
const Button = (0, react.forwardRef)(function Button({ size, variant, startIcon, endIcon, iconVariant, loading, disableEffects, children, asChild = false, slotProps, type = "button", className, width, ...rest }, forwardedRef) {
|
|
112
|
-
const ref = (0, react.useRef)(null);
|
|
113
|
-
(0, react.useImperativeHandle)(forwardedRef, () => ref.current);
|
|
114
|
-
const { className: startIconClassName, ...startIconSlotProps } = slotProps?.startIcon ?? {};
|
|
115
|
-
const { className: endIconClassName, ...endIconSlotProps } = slotProps?.endIcon ?? {};
|
|
116
|
-
const { className: contentClassName, ...contentSlotProps } = slotProps?.content ?? {};
|
|
117
|
-
const prefersReducedMotion = (0, motion_react.useReducedMotion)();
|
|
118
|
-
const disableMotion = !!disableEffects || !!rest?.disabled;
|
|
119
|
-
const layoutVariant = prefersReducedMotion ? "smooth" : "subtle";
|
|
120
|
-
const endVariant = endIcon ? "icon" : "hide";
|
|
121
|
-
const gapVariant = getGapVariant({
|
|
122
|
-
startIcon,
|
|
123
|
-
endIcon,
|
|
124
|
-
loading
|
|
125
|
-
});
|
|
126
|
-
const startVariant = getStartVariant({
|
|
127
|
-
loading,
|
|
128
|
-
startIcon
|
|
129
|
-
});
|
|
130
|
-
const Slot = (0, react.useMemo)(() => require_utils_createSlot.createSlot(), []);
|
|
131
|
-
const MotionSlot = (0, react.useMemo)(() => motion_react.m.create(Slot), [Slot]);
|
|
132
|
-
const buttonVariants = (0, react.useMemo)(() => ({
|
|
133
|
-
rest: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_REST})` },
|
|
134
|
-
hover: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_HOVER})` },
|
|
135
|
-
pressed: { scale: disableMotion ? 1 : `var(${require_index.BUTTON_SCALE_EFFECT_PRESSED})` },
|
|
136
|
-
withIcon: { columnGap: `var(${require_index.BUTTON_GAP_VAR})` },
|
|
137
|
-
withoutIcon: { columnGap: "0px" }
|
|
138
|
-
}), [disableMotion]);
|
|
139
|
-
const rootSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ buttonSizeRoot: size }) : defaultSizeRootClass, [size]);
|
|
140
|
-
const rootVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantRoot: variant }) : defaultVariantRootClass, [variant]);
|
|
141
|
-
const iconSizeClass = (0, react.useMemo)(() => size ? require_styles_styler.getStyles({ buttonSizeIcon: size }) : defaultSizeIconClass, [size]);
|
|
142
|
-
const iconVariantClass = (0, react.useMemo)(() => variant ? require_styles_styler.getStyles({ buttonVariantIcon: variant }) : defaultVariantIconClass, [variant]);
|
|
143
|
-
const styles = (0, react.useMemo)(() => ({
|
|
144
|
-
root: require_styles_styler.getStyles({
|
|
145
|
-
width,
|
|
146
|
-
className: require_styles_styler.cx([
|
|
147
|
-
"uds-ring",
|
|
148
|
-
"uds-hit-target",
|
|
149
|
-
"inline-flex max-w-full overflow-hidden justify-center items-center whitespace-nowrap select-none",
|
|
150
|
-
"[transform-origin:center]",
|
|
151
|
-
"[backface-visibility:hidden]",
|
|
152
|
-
"[transition-property:color,background-color,border-color,box-shadow,text-decoration-color,fill,stroke]",
|
|
153
|
-
"[transition-timing-function:cubic-bezier(0,0,0.2,1)]",
|
|
154
|
-
"[transition-duration:220ms]",
|
|
155
|
-
rootSizeClass,
|
|
156
|
-
rootVariantClass,
|
|
157
|
-
rest?.disabled && "cursor-not-allowed",
|
|
158
|
-
loading && "uds-button-loading",
|
|
159
|
-
disableEffects && "uds-button-without-effects",
|
|
160
|
-
gapVariant === "withIcon" && "uds-button-with-gap",
|
|
161
|
-
className
|
|
162
|
-
])
|
|
163
|
-
}),
|
|
164
|
-
iconContainer: "flex shrink-0 overflow-clip uds-button-icon-container",
|
|
165
|
-
icon: require_styles_styler.getStyles({ className: require_styles_styler.cx([iconSizeClass, iconVariantClass]) }),
|
|
166
|
-
loadingIcon: require_styles_styler.getStyles({ className: require_styles_styler.cx([
|
|
167
|
-
"animate-spin",
|
|
168
|
-
iconSizeClass,
|
|
169
|
-
iconVariantClass
|
|
170
|
-
]) }),
|
|
171
|
-
content: require_styles_styler.cx(["min-w-0 truncate"])
|
|
172
|
-
}), [
|
|
173
|
-
className,
|
|
174
|
-
disableEffects,
|
|
175
|
-
gapVariant,
|
|
176
|
-
iconSizeClass,
|
|
177
|
-
iconVariantClass,
|
|
178
|
-
loading,
|
|
179
|
-
rest?.disabled,
|
|
180
|
-
rootSizeClass,
|
|
181
|
-
rootVariantClass,
|
|
182
|
-
width
|
|
183
|
-
]);
|
|
184
|
-
const startContent = (0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
185
|
-
className: styles.iconContainer,
|
|
186
|
-
initial: false,
|
|
187
|
-
variants: iconContainerMotionVariants,
|
|
188
|
-
animate: startVariant,
|
|
189
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.AnimatePresence, {
|
|
190
|
-
initial: false,
|
|
191
|
-
mode: "popLayout",
|
|
192
|
-
children: [loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
193
|
-
variants: loadingMotionVariants,
|
|
194
|
-
initial: "hide",
|
|
195
|
-
animate: "loading",
|
|
196
|
-
exit: "hide",
|
|
197
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
|
|
198
|
-
className: styles.loadingIcon,
|
|
199
|
-
size: "sm",
|
|
200
|
-
name: _yahoo_uds_icons.Progress,
|
|
201
|
-
variant: iconVariant,
|
|
202
|
-
color: "current"
|
|
203
|
-
})
|
|
204
|
-
}, "loading"), startIcon && !loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
205
|
-
variants: iconMotionVariants,
|
|
206
|
-
initial: "hide",
|
|
207
|
-
animate: "icon",
|
|
208
|
-
exit: "hide",
|
|
209
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
210
|
-
className: require_styles_styler.cx(styles.icon, startIconClassName),
|
|
211
|
-
icon: startIcon,
|
|
212
|
-
iconProps: {
|
|
213
|
-
size: "sm",
|
|
214
|
-
variant: iconVariant,
|
|
215
|
-
color: "current"
|
|
216
|
-
},
|
|
217
|
-
...startIconSlotProps
|
|
218
|
-
})
|
|
219
|
-
})]
|
|
220
|
-
})
|
|
221
|
-
}), [
|
|
222
|
-
styles,
|
|
223
|
-
iconVariant,
|
|
224
|
-
loading,
|
|
225
|
-
startIcon,
|
|
226
|
-
startVariant,
|
|
227
|
-
startIconClassName,
|
|
228
|
-
startIconSlotProps
|
|
229
|
-
]);
|
|
230
|
-
const endContent = (0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
231
|
-
className: styles.iconContainer,
|
|
232
|
-
initial: false,
|
|
233
|
-
variants: iconContainerMotionVariants,
|
|
234
|
-
animate: endVariant,
|
|
235
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, {
|
|
236
|
-
initial: false,
|
|
237
|
-
mode: "popLayout",
|
|
238
|
-
children: endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.m.span, {
|
|
239
|
-
variants: iconMotionVariants,
|
|
240
|
-
initial: "hide",
|
|
241
|
-
animate: "icon",
|
|
242
|
-
exit: "hide",
|
|
243
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
244
|
-
className: require_styles_styler.cx(styles.icon, endIconClassName),
|
|
245
|
-
icon: endIcon,
|
|
246
|
-
iconProps: {
|
|
247
|
-
size: "sm",
|
|
248
|
-
variant: iconVariant,
|
|
249
|
-
color: "current"
|
|
250
|
-
},
|
|
251
|
-
...endIconSlotProps
|
|
252
|
-
})
|
|
253
|
-
})
|
|
254
|
-
})
|
|
255
|
-
}), [
|
|
256
|
-
endIcon,
|
|
257
|
-
styles,
|
|
258
|
-
iconVariant,
|
|
259
|
-
endVariant,
|
|
260
|
-
endIconClassName,
|
|
261
|
-
endIconSlotProps
|
|
262
|
-
]);
|
|
263
|
-
if (asChild && (0, react.isValidElement)(children)) {
|
|
264
|
-
const childProps = children.props;
|
|
265
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
266
|
-
layoutSpeed: "3",
|
|
267
|
-
layoutVariant,
|
|
268
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MotionSlot, {
|
|
269
|
-
type,
|
|
270
|
-
className: styles.root,
|
|
271
|
-
initial: ["rest", gapVariant],
|
|
272
|
-
animate: [
|
|
273
|
-
"hide",
|
|
274
|
-
"rest",
|
|
275
|
-
gapVariant
|
|
276
|
-
],
|
|
277
|
-
variants: buttonVariants,
|
|
278
|
-
whileHover: "hover",
|
|
279
|
-
whileTap: "pressed",
|
|
280
|
-
...rest,
|
|
281
|
-
children: (0, react.cloneElement)(children, childProps, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
282
|
-
startContent,
|
|
283
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
284
|
-
className: require_styles_styler.cx(styles.content, contentClassName),
|
|
285
|
-
...contentSlotProps,
|
|
286
|
-
children: children.props.children
|
|
287
|
-
}),
|
|
288
|
-
endContent
|
|
289
|
-
] }))
|
|
290
|
-
})
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
|
|
294
|
-
layoutSpeed: "3",
|
|
295
|
-
layoutVariant,
|
|
296
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion_react.m.button, {
|
|
297
|
-
ref,
|
|
298
|
-
type,
|
|
299
|
-
className: styles.root,
|
|
300
|
-
initial: ["rest", gapVariant],
|
|
301
|
-
animate: [
|
|
302
|
-
"hide",
|
|
303
|
-
"rest",
|
|
304
|
-
gapVariant
|
|
305
|
-
],
|
|
306
|
-
variants: buttonVariants,
|
|
307
|
-
whileHover: "hover",
|
|
308
|
-
whileTap: "pressed",
|
|
309
|
-
...rest,
|
|
310
|
-
children: [
|
|
311
|
-
startContent,
|
|
312
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
313
|
-
className: require_styles_styler.cx(styles.content, contentClassName),
|
|
314
|
-
...contentSlotProps,
|
|
315
|
-
children
|
|
316
|
-
}),
|
|
317
|
-
endContent
|
|
318
|
-
]
|
|
319
|
-
})
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
Button.displayName = "Button";
|
|
323
|
-
//#endregion
|
|
324
|
-
exports.Button = Button;
|
|
325
|
-
exports.iconMotionVariants = iconMotionVariants;
|
|
326
|
-
exports.loadingMotionVariants = loadingMotionVariants;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { UniversalButtonProps } from "../../types/dist/index.cjs";
|
|
3
|
-
import { IconPropsWithSVGProps } from "../../tokens/types.cjs";
|
|
4
|
-
import React, { ForwardRefExoticComponent } from "react";
|
|
5
|
-
import { HTMLMotionProps } from "motion/react";
|
|
6
|
-
|
|
7
|
-
//#region src/components/client/Button.d.ts
|
|
8
|
-
declare const iconMotionVariants: {
|
|
9
|
-
hide: {
|
|
10
|
-
scale: number;
|
|
11
|
-
opacity: number;
|
|
12
|
-
};
|
|
13
|
-
icon: {
|
|
14
|
-
scale: number[];
|
|
15
|
-
opacity: number[];
|
|
16
|
-
transition: {
|
|
17
|
-
times: number[];
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
loading: {
|
|
21
|
-
scale: number;
|
|
22
|
-
opacity: number;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
declare const loadingMotionVariants: {
|
|
26
|
-
hide: {
|
|
27
|
-
scale: number;
|
|
28
|
-
opacity: number;
|
|
29
|
-
};
|
|
30
|
-
icon: {
|
|
31
|
-
scale: number;
|
|
32
|
-
opacity: number;
|
|
33
|
-
};
|
|
34
|
-
loading: {
|
|
35
|
-
scale: number[];
|
|
36
|
-
opacity: number[];
|
|
37
|
-
transition: {
|
|
38
|
-
times: number[];
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
type HtmlButtonProps = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
|
43
|
-
type DataAttributes = {
|
|
44
|
-
[name: `data-${string}`]: string;
|
|
45
|
-
};
|
|
46
|
-
interface ButtonProps extends HtmlButtonProps, UniversalButtonProps {
|
|
47
|
-
/** Props to be passed into various slots within the component. */
|
|
48
|
-
slotProps?: {
|
|
49
|
-
startIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
50
|
-
endIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
51
|
-
content?: Partial<React.HTMLAttributes<HTMLSpanElement> & DataAttributes>;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* **🖲️ A button element that can be used to trigger an action**
|
|
56
|
-
*
|
|
57
|
-
* @componentType Client component
|
|
58
|
-
*
|
|
59
|
-
* @description A button is a fundamental component used to trigger an action or event. Buttons are interactive elements that users can click, tap, or otherwise engage with to submit forms, open dialogues, or perform any other interaction within an application or website. Consider an IconButton for buttons that only contain an icon.
|
|
60
|
-
*
|
|
61
|
-
* @see The {@link https://uds.build/docs/components/button Button Docs} for more info
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* 'use client';
|
|
66
|
-
* import { Button, HStack } from "@yahoo/uds";
|
|
67
|
-
*
|
|
68
|
-
* export function Demo() {
|
|
69
|
-
* return (
|
|
70
|
-
* <HStack gap="2">
|
|
71
|
-
* <Button onClick={console.log}>Save</Button>
|
|
72
|
-
* <Button variant="secondary" onClick={console.log}>Cancel</Button>
|
|
73
|
-
* </HStack>
|
|
74
|
-
* )
|
|
75
|
-
* }
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @usage
|
|
80
|
-
* Buttons should be used to clearly indicate and initiate actions that users can take.
|
|
81
|
-
*
|
|
82
|
-
* @related [Icon](https://uds.build/docs/components/icon), [IconButton](https://uds.build/docs/components/icon-button), [Pressable](https://uds.build/docs/components/pressable)
|
|
83
|
-
**/
|
|
84
|
-
declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
85
|
-
//#endregion
|
|
86
|
-
export { Button, type ButtonProps, iconMotionVariants, loadingMotionVariants };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
"use client";
|
|
3
|
-
import { UniversalButtonProps } from "../../types/dist/index.js";
|
|
4
|
-
import { IconPropsWithSVGProps } from "../../tokens/types.js";
|
|
5
|
-
import React, { ForwardRefExoticComponent } from "react";
|
|
6
|
-
import { HTMLMotionProps } from "motion/react";
|
|
7
|
-
|
|
8
|
-
//#region src/components/client/Button.d.ts
|
|
9
|
-
declare const iconMotionVariants: {
|
|
10
|
-
hide: {
|
|
11
|
-
scale: number;
|
|
12
|
-
opacity: number;
|
|
13
|
-
};
|
|
14
|
-
icon: {
|
|
15
|
-
scale: number[];
|
|
16
|
-
opacity: number[];
|
|
17
|
-
transition: {
|
|
18
|
-
times: number[];
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
loading: {
|
|
22
|
-
scale: number;
|
|
23
|
-
opacity: number;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
declare const loadingMotionVariants: {
|
|
27
|
-
hide: {
|
|
28
|
-
scale: number;
|
|
29
|
-
opacity: number;
|
|
30
|
-
};
|
|
31
|
-
icon: {
|
|
32
|
-
scale: number;
|
|
33
|
-
opacity: number;
|
|
34
|
-
};
|
|
35
|
-
loading: {
|
|
36
|
-
scale: number[];
|
|
37
|
-
opacity: number[];
|
|
38
|
-
transition: {
|
|
39
|
-
times: number[];
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
type HtmlButtonProps = Omit<HTMLMotionProps<'button'>, 'color' | 'name'> & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>;
|
|
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
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* **🖲️ A button element that can be used to trigger an action**
|
|
57
|
-
*
|
|
58
|
-
* @componentType Client component
|
|
59
|
-
*
|
|
60
|
-
* @description A button is a fundamental component used to trigger an action or event. Buttons are interactive elements that users can click, tap, or otherwise engage with to submit forms, open dialogues, or perform any other interaction within an application or website. Consider an IconButton for buttons that only contain an icon.
|
|
61
|
-
*
|
|
62
|
-
* @see The {@link https://uds.build/docs/components/button Button Docs} for more info
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```tsx
|
|
66
|
-
* 'use client';
|
|
67
|
-
* import { Button, HStack } from "@yahoo/uds";
|
|
68
|
-
*
|
|
69
|
-
* export function Demo() {
|
|
70
|
-
* return (
|
|
71
|
-
* <HStack gap="2">
|
|
72
|
-
* <Button onClick={console.log}>Save</Button>
|
|
73
|
-
* <Button variant="secondary" onClick={console.log}>Cancel</Button>
|
|
74
|
-
* </HStack>
|
|
75
|
-
* )
|
|
76
|
-
* }
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @usage
|
|
81
|
-
* Buttons should be used to clearly indicate and initiate actions that users can take.
|
|
82
|
-
*
|
|
83
|
-
* @related [Icon](https://uds.build/docs/components/icon), [IconButton](https://uds.build/docs/components/icon-button), [Pressable](https://uds.build/docs/components/pressable)
|
|
84
|
-
**/
|
|
85
|
-
declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
86
|
-
//#endregion
|
|
87
|
-
export { Button, type ButtonProps, iconMotionVariants, loadingMotionVariants };
|