@yahoo/uds-mobile 1.1.0 → 1.2.0-beta.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/CONTRIBUTING.md +1 -1
- package/dist/bin/{uds/dist/fixtures.mjs → fixtures/dist/index.mjs} +8 -16
- package/dist/bin/{uds/dist/tokens/consts/fontDeclarationsMap.mjs → fonts/dist/index.mjs} +2 -2
- package/dist/bin/generateTheme.mjs +10 -8
- package/dist/bin/modes/dist/index.mjs +6 -0
- package/dist/bin/{uds/dist/tokens/configs/palette/alwaysPalette.mjs → palette/dist/index.mjs} +1 -1
- package/dist/components/Avatar.d.cts +2 -2
- package/dist/components/Badge.d.cts +3 -3
- package/dist/components/Badge.d.mts +3 -3
- package/dist/components/Badge.mjs.map +1 -1
- package/dist/components/Box.cjs +1 -1
- package/dist/components/Box.d.cts +3 -3
- package/dist/components/Box.d.mts +3 -3
- package/dist/components/Box.mjs +1 -1
- package/dist/components/Box.mjs.map +1 -1
- package/dist/components/Button.cjs +6 -6
- package/dist/components/Button.d.cts +3 -4
- package/dist/components/Button.d.cts.map +1 -1
- package/dist/components/Button.d.mts +3 -4
- package/dist/components/Button.d.mts.map +1 -1
- package/dist/components/Button.mjs +1 -1
- package/dist/components/Button.mjs.map +1 -1
- package/dist/components/Checkbox.cjs +4 -4
- package/dist/components/Checkbox.d.cts +3 -3
- package/dist/components/Checkbox.d.mts +3 -3
- package/dist/components/Checkbox.d.mts.map +1 -1
- package/dist/components/Checkbox.mjs +1 -1
- package/dist/components/Checkbox.mjs.map +1 -1
- package/dist/components/Chip.d.cts +3 -3
- package/dist/components/Chip.d.mts +3 -3
- package/dist/components/Chip.d.mts.map +1 -1
- package/dist/components/Chip.mjs.map +1 -1
- package/dist/components/HStack.d.cts +2 -2
- package/dist/components/HStack.d.mts +2 -2
- package/dist/components/HStack.d.mts.map +1 -1
- package/dist/components/Icon.d.cts +3 -4
- package/dist/components/Icon.d.cts.map +1 -1
- package/dist/components/Icon.d.mts +3 -4
- package/dist/components/Icon.d.mts.map +1 -1
- package/dist/components/Icon.mjs.map +1 -1
- package/dist/components/IconButton.cjs +5 -5
- package/dist/components/IconButton.d.cts +3 -4
- package/dist/components/IconButton.d.cts.map +1 -1
- package/dist/components/IconButton.d.mts +3 -4
- package/dist/components/IconButton.d.mts.map +1 -1
- package/dist/components/IconButton.mjs +1 -1
- package/dist/components/IconButton.mjs.map +1 -1
- package/dist/components/IconSlot.d.cts +2 -2
- package/dist/components/IconSlot.d.mts +2 -2
- package/dist/components/IconSlot.d.mts.map +1 -1
- package/dist/components/Image.d.cts +3 -3
- package/dist/components/Image.d.mts +3 -3
- package/dist/components/Image.d.mts.map +1 -1
- package/dist/components/Image.mjs.map +1 -1
- package/dist/components/Input.d.cts +3 -3
- package/dist/components/Input.d.mts +3 -3
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.mjs.map +1 -1
- package/dist/components/Link.d.cts +3 -4
- package/dist/components/Link.d.cts.map +1 -1
- package/dist/components/Link.d.mts +3 -4
- package/dist/components/Link.d.mts.map +1 -1
- package/dist/components/Link.mjs.map +1 -1
- package/dist/components/Pressable.d.mts +3 -3
- package/dist/components/Radio.cjs +4 -4
- package/dist/components/Radio.d.cts +3 -3
- package/dist/components/Radio.d.mts +3 -3
- package/dist/components/Radio.mjs +1 -1
- package/dist/components/Radio.mjs.map +1 -1
- package/dist/components/Screen.d.cts +2 -2
- package/dist/components/Screen.d.mts +2 -2
- package/dist/components/Screen.d.mts.map +1 -1
- package/dist/components/Switch.d.cts +3 -3
- package/dist/components/Switch.d.cts.map +1 -1
- package/dist/components/Switch.d.mts +3 -3
- package/dist/components/Switch.d.mts.map +1 -1
- package/dist/components/Switch.mjs.map +1 -1
- package/dist/components/Text.d.cts +2 -2
- package/dist/components/Text.d.mts +2 -2
- package/dist/components/VStack.d.cts +2 -2
- package/dist/components/VStack.d.mts +2 -2
- package/dist/components/VStack.d.mts.map +1 -1
- package/dist/icons/dist/glyphMap.d.cts.map +1 -1
- package/dist/icons/dist/glyphMap.d.mts.map +1 -1
- package/dist/icons/dist/glyphMap.mjs.map +1 -1
- package/dist/icons/dist/svgMap.d.cts.map +1 -1
- package/dist/icons/dist/svgMap.d.mts.map +1 -1
- package/dist/icons/dist/svgMap.mjs.map +1 -1
- package/dist/icons/dist/tokens.mjs.map +1 -1
- package/dist/{uds/dist/tokens/configs/motion.cjs → motion-tokens/dist/index.cjs} +2 -2
- package/dist/{uds/dist/tokens/configs/motion.d.mts → motion-tokens/dist/index.d.cts} +4 -4
- package/dist/motion-tokens/dist/index.d.cts.map +1 -0
- package/dist/{uds/dist/tokens/configs/motion.d.cts → motion-tokens/dist/index.d.mts} +4 -4
- package/dist/motion-tokens/dist/index.d.mts.map +1 -0
- package/dist/{uds/dist/tokens/configs/motion.mjs → motion-tokens/dist/index.mjs} +3 -3
- package/dist/motion-tokens/dist/index.mjs.map +1 -0
- package/dist/motion.cjs +12 -12
- package/dist/motion.d.cts +2 -3
- package/dist/motion.d.cts.map +1 -1
- package/dist/motion.d.mts +2 -3
- package/dist/motion.d.mts.map +1 -1
- package/dist/motion.mjs +1 -1
- package/dist/motion.mjs.map +1 -1
- package/dist/types/dist/index.d.cts +247 -0
- package/dist/types/dist/index.d.cts.map +1 -0
- package/dist/types/dist/index.d.mts +247 -0
- package/dist/types/dist/index.d.mts.map +1 -0
- package/fonts/index.cjs +205 -205
- package/fonts/index.mjs +205 -205
- package/package.json +1 -1
- package/dist/bin/uds/dist/tokens/consts/defaultModes.mjs +0 -6
- package/dist/icons/dist/types.d.cts +0 -24
- package/dist/icons/dist/types.d.cts.map +0 -1
- package/dist/icons/dist/types.d.mts +0 -24
- package/dist/icons/dist/types.d.mts.map +0 -1
- package/dist/uds/dist/components/Box.d.cts +0 -3
- package/dist/uds/dist/components/Box.d.mts +0 -3
- package/dist/uds/dist/components/Divider/Divider.d.cts +0 -3
- package/dist/uds/dist/components/Divider/Divider.d.mts +0 -3
- package/dist/uds/dist/components/Divider/DividerCore.d.cts +0 -4
- package/dist/uds/dist/components/Divider/DividerCore.d.mts +0 -4
- package/dist/uds/dist/components/Divider/DividerInternal.d.cts +0 -4
- package/dist/uds/dist/components/Divider/DividerInternal.d.mts +0 -4
- package/dist/uds/dist/components/Divider/index.d.cts +0 -2
- package/dist/uds/dist/components/Divider/index.d.mts +0 -2
- package/dist/uds/dist/components/FormLabel.d.cts +0 -3
- package/dist/uds/dist/components/FormLabel.d.mts +0 -4
- package/dist/uds/dist/components/HStack.d.cts +0 -4
- package/dist/uds/dist/components/HStack.d.mts +0 -4
- package/dist/uds/dist/components/Icon.d.cts +0 -3
- package/dist/uds/dist/components/Icon.d.mts +0 -3
- package/dist/uds/dist/components/Image.d.cts +0 -2
- package/dist/uds/dist/components/Image.d.mts +0 -3
- package/dist/uds/dist/components/Link.d.cts +0 -3
- package/dist/uds/dist/components/Link.d.mts +0 -3
- package/dist/uds/dist/components/Text.d.cts +0 -3
- package/dist/uds/dist/components/Text.d.mts +0 -3
- package/dist/uds/dist/components/VStack.d.cts +0 -4
- package/dist/uds/dist/components/VStack.d.mts +0 -4
- package/dist/uds/dist/components/client/Avatar/Avatar.d.cts +0 -2
- package/dist/uds/dist/components/client/Avatar/Avatar.d.mts +0 -3
- package/dist/uds/dist/components/client/Avatar/AvatarIcon.d.cts +0 -2
- package/dist/uds/dist/components/client/Avatar/AvatarIcon.d.mts +0 -3
- package/dist/uds/dist/components/client/Avatar/AvatarImage.d.cts +0 -4
- package/dist/uds/dist/components/client/Avatar/AvatarImage.d.mts +0 -5
- package/dist/uds/dist/components/client/Avatar/AvatarText.d.cts +0 -3
- package/dist/uds/dist/components/client/Avatar/AvatarText.d.mts +0 -4
- package/dist/uds/dist/components/client/Avatar/index.d.cts +0 -5
- package/dist/uds/dist/components/client/Avatar/index.d.mts +0 -5
- package/dist/uds/dist/components/client/Badge.d.cts +0 -3
- package/dist/uds/dist/components/client/Badge.d.mts +0 -3
- package/dist/uds/dist/components/client/Button.d.cts +0 -3
- package/dist/uds/dist/components/client/Button.d.mts +0 -3
- package/dist/uds/dist/components/client/Checkbox.d.cts +0 -3
- package/dist/uds/dist/components/client/Checkbox.d.mts +0 -3
- package/dist/uds/dist/components/client/Chip/Chip.d.cts +0 -4
- package/dist/uds/dist/components/client/Chip/Chip.d.mts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipBase.d.cts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipBase.d.mts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipButton.d.cts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipButton.d.mts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipDismissible.d.cts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipDismissible.d.mts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipLink.d.cts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipLink.d.mts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipToggle.d.cts +0 -4
- package/dist/uds/dist/components/client/Chip/ChipToggle.d.mts +0 -4
- package/dist/uds/dist/components/client/Chip/index.d.cts +0 -6
- package/dist/uds/dist/components/client/Chip/index.d.mts +0 -6
- package/dist/uds/dist/components/client/IconButton.d.cts +0 -3
- package/dist/uds/dist/components/client/IconButton.d.mts +0 -3
- package/dist/uds/dist/components/client/Input/Input.d.cts +0 -4
- package/dist/uds/dist/components/client/Input/Input.d.mts +0 -4
- package/dist/uds/dist/components/client/Input/InputHelpText.d.cts +0 -2
- package/dist/uds/dist/components/client/Input/InputHelpText.d.mts +0 -3
- package/dist/uds/dist/components/client/Input/InputHelpTextInternal.d.cts +0 -5
- package/dist/uds/dist/components/client/Input/InputHelpTextInternal.d.mts +0 -6
- package/dist/uds/dist/components/client/Input/index.d.cts +0 -3
- package/dist/uds/dist/components/client/Input/index.d.mts +0 -3
- package/dist/uds/dist/components/client/Menu/Menu.Content.d.cts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.Content.d.mts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.Divider.d.cts +0 -3
- package/dist/uds/dist/components/client/Menu/Menu.Divider.d.mts +0 -3
- package/dist/uds/dist/components/client/Menu/Menu.Item.d.cts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.Item.d.mts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.ItemCheckbox.d.mts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.Provider.d.cts +0 -2
- package/dist/uds/dist/components/client/Menu/Menu.Provider.d.mts +0 -3
- package/dist/uds/dist/components/client/Menu/Menu.Trigger.d.cts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.Trigger.d.mts +0 -4
- package/dist/uds/dist/components/client/Menu/Menu.d.cts +0 -2
- package/dist/uds/dist/components/client/Menu/Menu.d.mts +0 -2
- package/dist/uds/dist/components/client/Menu/Menu.index.d.cts +0 -7
- package/dist/uds/dist/components/client/Menu/Menu.index.d.mts +0 -7
- package/dist/uds/dist/components/client/Menu/index.d.cts +0 -9
- package/dist/uds/dist/components/client/Menu/index.d.mts +0 -9
- package/dist/uds/dist/components/client/Pressable.d.cts +0 -3
- package/dist/uds/dist/components/client/Pressable.d.mts +0 -3
- package/dist/uds/dist/components/client/Radio/Radio.d.cts +0 -3
- package/dist/uds/dist/components/client/Radio/Radio.d.mts +0 -3
- package/dist/uds/dist/components/client/Radio/RadioGroupProvider.d.cts +0 -3
- package/dist/uds/dist/components/client/Radio/RadioGroupProvider.d.mts +0 -3
- package/dist/uds/dist/components/client/Radio/index.d.cts +0 -3
- package/dist/uds/dist/components/client/Radio/index.d.mts +0 -3
- package/dist/uds/dist/components/client/SpringMotionConfig.d.cts +0 -3
- package/dist/uds/dist/components/client/SpringMotionConfig.d.mts +0 -3
- package/dist/uds/dist/components/client/Switch.d.cts +0 -3
- package/dist/uds/dist/components/client/Switch.d.mts +0 -3
- package/dist/uds/dist/components/client/index.d.cts +0 -33
- package/dist/uds/dist/components/client/index.d.mts +0 -33
- package/dist/uds/dist/components/index.d.cts +0 -40
- package/dist/uds/dist/components/index.d.mts +0 -40
- package/dist/uds/dist/index.d.cts +0 -46
- package/dist/uds/dist/index.d.mts +0 -46
- package/dist/uds/dist/styles/styler.d.cts +0 -2
- package/dist/uds/dist/styles/styler.d.mts +0 -2
- package/dist/uds/dist/styles/stylerTypes.d.cts +0 -2
- package/dist/uds/dist/styles/stylerTypes.d.mts +0 -2
- package/dist/uds/dist/tokens/automation/configs/avatar.d.cts +0 -2
- package/dist/uds/dist/tokens/automation/configs/avatar.d.mts +0 -2
- package/dist/uds/dist/tokens/automation/properties.d.cts +0 -3
- package/dist/uds/dist/tokens/automation/properties.d.mts +0 -3
- package/dist/uds/dist/tokens/automation/types/ComponentConfig.d.cts +0 -3
- package/dist/uds/dist/tokens/automation/types/ComponentConfig.d.mts +0 -3
- package/dist/uds/dist/tokens/configs/motion.d.cts.map +0 -1
- package/dist/uds/dist/tokens/configs/motion.d.mts.map +0 -1
- package/dist/uds/dist/tokens/configs/motion.mjs.map +0 -1
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.cts +0 -32
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.cts.map +0 -1
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.mts +0 -32
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.mts.map +0 -1
- package/dist/uds/dist/tokens/types.d.cts +0 -426
- package/dist/uds/dist/tokens/types.d.cts.map +0 -1
- package/dist/uds/dist/tokens/types.d.mts +0 -426
- package/dist/uds/dist/tokens/types.d.mts.map +0 -1
- package/dist/uds/dist/types.d.cts +0 -2
- package/dist/uds/dist/types.d.mts +0 -2
package/CONTRIBUTING.md
CHANGED
|
@@ -104,7 +104,7 @@ This is the most important generated file. It contains all Unistyles stylesheets
|
|
|
104
104
|
**Example input** (from `uds.config.ts` - see `packages/configurator/uds.config.ts`):
|
|
105
105
|
|
|
106
106
|
```typescript
|
|
107
|
-
import type { UniversalTokensConfig } from '@yahoo/uds';
|
|
107
|
+
import type { UniversalTokensConfig } from '@yahoo/uds-types';
|
|
108
108
|
|
|
109
109
|
export const config: UniversalTokensConfig = {
|
|
110
110
|
// Component configs use path-based keys: '{dimension}/{value}/{layer}'
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//#region ../
|
|
3
|
-
function fromEntries(item) {
|
|
4
|
-
return Object.fromEntries(item);
|
|
5
|
-
}
|
|
2
|
+
//#region ../fixtures/dist/index.js
|
|
6
3
|
var elevationAliases = [
|
|
7
4
|
"elevation-0",
|
|
8
5
|
"elevation-1",
|
|
@@ -172,6 +169,7 @@ var opacitySteps = [
|
|
|
172
169
|
"99",
|
|
173
170
|
"100"
|
|
174
171
|
];
|
|
172
|
+
var fromEntries = (item) => Object.fromEntries(item);
|
|
175
173
|
var opacityMap = fromEntries(opacitySteps.map((key) => [key, `${parseInt(key) / 100}`]));
|
|
176
174
|
var backgroundColors = [
|
|
177
175
|
...backgroundPaletteColors,
|
|
@@ -202,9 +200,7 @@ var iconSizes = [
|
|
|
202
200
|
"md",
|
|
203
201
|
"lg",
|
|
204
202
|
"xs"
|
|
205
|
-
].sort((a, b) =>
|
|
206
|
-
return iconSizeSort[a] - iconSizeSort[b];
|
|
207
|
-
});
|
|
203
|
+
].sort((a, b) => iconSizeSort[a] - iconSizeSort[b]);
|
|
208
204
|
var spacingMap = {
|
|
209
205
|
"0": 0,
|
|
210
206
|
px: 1,
|
|
@@ -378,9 +374,9 @@ var buttonVariantsFlat = [
|
|
|
378
374
|
if (aPriority !== bPriority) return aPriority - bPriority;
|
|
379
375
|
return a.localeCompare(b);
|
|
380
376
|
});
|
|
381
|
-
var buttonVariantsSecondary = buttonVariantsFlat.filter((
|
|
382
|
-
var buttonVariantsTertiary = buttonVariantsFlat.filter((
|
|
383
|
-
var buttonVariantsPrimary = buttonVariantsFlat.filter((
|
|
377
|
+
var buttonVariantsSecondary = buttonVariantsFlat.filter((v) => v.includes("secondary"));
|
|
378
|
+
var buttonVariantsTertiary = buttonVariantsFlat.filter((v) => v.includes("tertiary"));
|
|
379
|
+
var buttonVariantsPrimary = buttonVariantsFlat.filter((v) => !buttonVariantsSecondary.includes(v) && !buttonVariantsTertiary.includes(v));
|
|
384
380
|
var preferredTShirtSizeSort = {
|
|
385
381
|
none: 0,
|
|
386
382
|
xs: 1,
|
|
@@ -395,18 +391,14 @@ var buttonSizes = [
|
|
|
395
391
|
"md",
|
|
396
392
|
"lg",
|
|
397
393
|
"xs"
|
|
398
|
-
].sort((a, b) =>
|
|
399
|
-
return preferredTShirtSizeSort[a] - preferredTShirtSizeSort[b];
|
|
400
|
-
});
|
|
394
|
+
].sort((a, b) => preferredTShirtSizeSort[a] - preferredTShirtSizeSort[b]);
|
|
401
395
|
var iconButtonSizes = [
|
|
402
396
|
"sm",
|
|
403
397
|
"md",
|
|
404
398
|
"lg",
|
|
405
399
|
"xl",
|
|
406
400
|
"xs"
|
|
407
|
-
].sort((a, b) =>
|
|
408
|
-
return preferredTShirtSizeSort[a] - preferredTShirtSizeSort[b];
|
|
409
|
-
});
|
|
401
|
+
].sort((a, b) => preferredTShirtSizeSort[a] - preferredTShirtSizeSort[b]);
|
|
410
402
|
var shadowVariants = [
|
|
411
403
|
"none",
|
|
412
404
|
"xs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//#region ../
|
|
3
|
-
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../fonts/dist/index.js
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS Fonts v0.0.0-development */
|
|
4
4
|
const UDS_FONTS_CDN_PREFIX = "https://s.yimg.com/bw/fonts";
|
|
5
5
|
const sansFallbacks = [
|
|
6
6
|
"Helvetica Neue",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { spacingMap } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { DEFAULT_SCALE_MODE } from "./
|
|
5
|
-
import {
|
|
2
|
+
import { spacingMap } from "./fixtures/dist/index.mjs";
|
|
3
|
+
import { FONT_DECLARATIONS_MAP } from "./fonts/dist/index.mjs";
|
|
4
|
+
import { DEFAULT_SCALE_MODE } from "./modes/dist/index.mjs";
|
|
5
|
+
import { newAlwaysPalette } from "./palette/dist/index.mjs";
|
|
6
6
|
import { MOBILE_STATES, PROPERTY_TO_RN_PROPS, SHADOW_PROPS, TEXT_ONLY_PROPS, toSlashKey } from "./mobile/scripts/utils/configToRNMappings.mjs";
|
|
7
7
|
import { fontAliasToPostscript } from "@yahoo/uds-mobile/fonts";
|
|
8
8
|
|
|
@@ -45,13 +45,15 @@ function sortKeys(obj) {
|
|
|
45
45
|
for (const key of keys) sorted[key] = sortKeys(obj[key]);
|
|
46
46
|
return sorted;
|
|
47
47
|
}
|
|
48
|
+
function isWebFontID(value) {
|
|
49
|
+
return value in FONT_DECLARATIONS_MAP;
|
|
50
|
+
}
|
|
48
51
|
/**
|
|
49
52
|
* Converts a FontID and weight value to a PostScript font name.
|
|
50
53
|
* React Native requires PostScript names to load fonts, not CSS font-family + weight.
|
|
51
54
|
*/
|
|
52
55
|
function getPostScriptName(fontId, weight, italic = false) {
|
|
53
56
|
const fontConfig = FONT_DECLARATIONS_MAP[fontId];
|
|
54
|
-
if (!fontConfig) return fontId;
|
|
55
57
|
let weightConfig = fontConfig.fontWeights.find((w) => w.value === weight);
|
|
56
58
|
if (!weightConfig) weightConfig = fontConfig.fontWeights.reduce((closest, current) => {
|
|
57
59
|
const closestDiff = Math.abs(closest.value - weight);
|
|
@@ -148,7 +150,7 @@ function generateTypography(typographyConfig, fontConfig) {
|
|
|
148
150
|
const fontAlias = style.fontFamily.base;
|
|
149
151
|
const fontId = fontConfig[fontAlias] ?? fontAlias;
|
|
150
152
|
const weight = Number(style.fontWeight.base.value);
|
|
151
|
-
const postScriptName = fontId
|
|
153
|
+
const postScriptName = isWebFontID(fontId) ? getPostScriptName(fontId, weight) : fontId;
|
|
152
154
|
result[variant] = {
|
|
153
155
|
fontSize: parseTypographyValue(style.fontSize.base),
|
|
154
156
|
lineHeight: parseTypographyValue(style.lineHeight.base),
|
|
@@ -161,7 +163,7 @@ function generateTypography(typographyConfig, fontConfig) {
|
|
|
161
163
|
}
|
|
162
164
|
function generateFontAliases(fontConfig) {
|
|
163
165
|
const result = {};
|
|
164
|
-
for (const [alias, fontId] of Object.entries(fontConfig)) if (fontId
|
|
166
|
+
for (const [alias, fontId] of Object.entries(fontConfig)) if (isWebFontID(fontId)) {
|
|
165
167
|
const defaultWeight = FONT_DECLARATIONS_MAP[fontId].defaults.fontWeight;
|
|
166
168
|
result[alias] = getPostScriptName(fontId, defaultWeight);
|
|
167
169
|
} else result[alias] = fontId;
|
|
@@ -201,7 +203,7 @@ function resolveTypographyStyles(variantName, typography, config) {
|
|
|
201
203
|
if (typeof letterSpacing === "number") result.letterSpacing = letterSpacing;
|
|
202
204
|
if (typeof fontFamily === "string") {
|
|
203
205
|
const fontId = config.font[fontFamily] ?? fontFamily;
|
|
204
|
-
if (fontId
|
|
206
|
+
if (isWebFontID(fontId)) result.fontFamily = getPostScriptName(fontId, typeof fontWeight === "number" ? fontWeight : 400);
|
|
205
207
|
else result.fontFamily = fontId;
|
|
206
208
|
}
|
|
207
209
|
return result;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { IconSlotType } from "./IconSlot.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react0 from "react";
|
|
4
4
|
import { View, ViewProps } from "react-native";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Avatar.d.ts
|
|
@@ -54,7 +54,7 @@ interface AvatarProps extends ViewProps {
|
|
|
54
54
|
*
|
|
55
55
|
* @see The {@link https://uds.build/docs/components/avatar Avatar Docs} for more info
|
|
56
56
|
*/
|
|
57
|
-
declare const Avatar:
|
|
57
|
+
declare const Avatar: react0.ForwardRefExoticComponent<AvatarProps & react0.RefAttributes<View>>;
|
|
58
58
|
//#endregion
|
|
59
59
|
export { Avatar, type AvatarProps };
|
|
60
60
|
//# sourceMappingURL=Avatar.d.cts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { BadgeSize, BadgeVariant } from "../
|
|
2
|
+
import { BadgeSize, BadgeVariant } from "../types/dist/index.cjs";
|
|
3
3
|
import { IconSlotType } from "./IconSlot.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react1 from "react";
|
|
5
5
|
import { Ref } from "react";
|
|
6
6
|
import { View, ViewProps } from "react-native";
|
|
7
7
|
|
|
@@ -37,7 +37,7 @@ interface BadgeProps extends ViewProps {
|
|
|
37
37
|
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
declare const Badge:
|
|
40
|
+
declare const Badge: react1.NamedExoticComponent<BadgeProps>;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { Badge, type BadgeProps };
|
|
43
43
|
//# sourceMappingURL=Badge.d.cts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { BadgeSize, BadgeVariant } from "../
|
|
2
|
+
import { BadgeSize, BadgeVariant } from "../types/dist/index.mjs";
|
|
3
3
|
import { IconSlotType } from "./IconSlot.mjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react3 from "react";
|
|
5
5
|
import { Ref } from "react";
|
|
6
6
|
import { View, ViewProps } from "react-native";
|
|
7
7
|
|
|
@@ -37,7 +37,7 @@ interface BadgeProps extends ViewProps {
|
|
|
37
37
|
* <Badge variant="alert" startIcon="Warning">Error</Badge>
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
declare const Badge:
|
|
40
|
+
declare const Badge: react3.NamedExoticComponent<BadgeProps>;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { Badge, type BadgeProps };
|
|
43
43
|
//# sourceMappingURL=Badge.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.mjs","names":["Badge"],"sources":["../../src/components/Badge.tsx"],"sourcesContent":["import type { BadgeSize, BadgeVariant } from '@yahoo/uds
|
|
1
|
+
{"version":3,"file":"Badge.mjs","names":["Badge"],"sources":["../../src/components/Badge.tsx"],"sourcesContent":["import type { BadgeSize, BadgeVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { View, ViewProps } from 'react-native';\n\nimport { badgeStyles } from '../../generated/styles';\nimport { HStack } from './HStack';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport { Text } from './Text';\n\ninterface BadgeProps extends ViewProps {\n /** @default 'primary' */\n variant?: BadgeVariant;\n /** @default 'md' */\n size?: BadgeSize;\n minWidth?: number;\n /** @default 200 */\n maxWidth?: number;\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\n dangerouslySetBackgroundColor?: string;\n dangerouslySetColor?: string;\n dangerouslySetBorderColor?: string;\n dangerouslySetIconColor?: string;\n ref?: Ref<View>;\n}\n\n/**\n * **A badge component for status indicators**\n *\n * @description\n * Badges show notifications, counts, or status information on navigation items and icons.\n *\n * @example\n * ```tsx\n * import { Badge } from '~/components/ui/Badge';\n *\n * <Badge>Label</Badge>\n * <Badge variant=\"brand\" size=\"sm\">New</Badge>\n * <Badge variant=\"alert\" startIcon=\"Warning\">Error</Badge>\n * ```\n */\nconst Badge = memo(function Badge({\n variant = 'primary',\n size = 'md',\n minWidth,\n maxWidth = 200,\n startIcon,\n endIcon,\n dangerouslySetBackgroundColor,\n dangerouslySetColor,\n dangerouslySetIconColor,\n dangerouslySetBorderColor,\n children,\n style,\n ref,\n ...rest\n}: BadgeProps) {\n badgeStyles.useVariants({ size, variant });\n const rootStyles = useMemo(() => [badgeStyles.root, style], [style, badgeStyles.root]);\n\n return (\n <HStack\n ref={ref}\n alignItems=\"center\"\n overflow=\"hidden\"\n alignSelf=\"flex-start\"\n maxWidth={maxWidth}\n minWidth={minWidth}\n dangerouslySetBackgroundColor={dangerouslySetBackgroundColor}\n dangerouslySetBorderColor={dangerouslySetBorderColor}\n // Cannot memoize - styles contain theme-reactive values\n style={rootStyles}\n {...rest}\n >\n {startIcon && (\n <IconSlot\n icon={startIcon}\n variant=\"fill\"\n dangerouslySetColor={dangerouslySetIconColor}\n style={badgeStyles.icon}\n />\n )}\n <Text\n numberOfLines={1}\n flexShrink=\"1\"\n dangerouslySetColor={dangerouslySetColor}\n style={badgeStyles.text}\n >\n {children}\n </Text>\n {endIcon && (\n <IconSlot\n icon={endIcon}\n variant=\"fill\"\n dangerouslySetColor={dangerouslySetIconColor}\n style={badgeStyles.icon}\n />\n )}\n </HStack>\n );\n});\n\nBadge.displayName = 'Badge';\n\nexport { Badge, type BadgeProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,QAAQ,KAAK,SAASA,QAAM,EAChC,UAAU,WACV,OAAO,MACP,UACA,WAAW,KACX,WACA,SACA,+BACA,qBACA,yBACA,2BACA,UACA,OACA,KACA,GAAG,QACU;AACb,aAAY,YAAY;EAAE;EAAM;EAAS,CAAC;AAG1C,QACE,qBAAC;EACM;EACL,YAAW;EACX,UAAS;EACT,WAAU;EACA;EACA;EACqB;EACJ;EAE3B,OAbe,cAAc,CAAC,YAAY,MAAM,MAAM,EAAE,CAAC,OAAO,YAAY,KAAK,CAAC;EAclF,GAAI;;GAEH,aACC,oBAAC;IACC,MAAM;IACN,SAAQ;IACR,qBAAqB;IACrB,OAAO,YAAY;KACnB;GAEJ,oBAAC;IACC,eAAe;IACf,YAAW;IACU;IACrB,OAAO,YAAY;IAElB;KACI;GACN,WACC,oBAAC;IACC,MAAM;IACN,SAAQ;IACR,qBAAqB;IACrB,OAAO,YAAY;KACnB;;GAEG;EAEX;AAEF,MAAM,cAAc"}
|
package/dist/components/Box.cjs
CHANGED
|
@@ -16,7 +16,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```tsx
|
|
19
|
-
* import { Box } from '@yahoo/uds';
|
|
19
|
+
* import { Box } from '@yahoo/uds-mobile/Box';
|
|
20
20
|
*
|
|
21
21
|
* <Box backgroundColor="primary" spacing="6">
|
|
22
22
|
* Any kind of content can go here!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { SizeProps } from "../types.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react3 from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
import { StyleProps } from "../../generated/styles";
|
|
@@ -66,7 +66,7 @@ interface BoxProps extends ViewProps, SizeProps {
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* ```tsx
|
|
69
|
-
* import { Box } from '@yahoo/uds';
|
|
69
|
+
* import { Box } from '@yahoo/uds-mobile/Box';
|
|
70
70
|
*
|
|
71
71
|
* <Box backgroundColor="primary" spacing="6">
|
|
72
72
|
* Any kind of content can go here!
|
|
@@ -81,7 +81,7 @@ interface BoxProps extends ViewProps, SizeProps {
|
|
|
81
81
|
*
|
|
82
82
|
* @related [HStack](https://uds.build/docs/components/h-stack), [VStack](https://uds.build/docs/components/v-stack)
|
|
83
83
|
*/
|
|
84
|
-
declare const Box:
|
|
84
|
+
declare const Box: react3.NamedExoticComponent<BoxProps>;
|
|
85
85
|
//#endregion
|
|
86
86
|
export { Box, type BoxProps };
|
|
87
87
|
//# sourceMappingURL=Box.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { SizeProps } from "../types.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react1 from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
import { StyleProps } from "../../generated/styles";
|
|
@@ -66,7 +66,7 @@ interface BoxProps extends ViewProps, SizeProps {
|
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* ```tsx
|
|
69
|
-
* import { Box } from '@yahoo/uds';
|
|
69
|
+
* import { Box } from '@yahoo/uds-mobile/Box';
|
|
70
70
|
*
|
|
71
71
|
* <Box backgroundColor="primary" spacing="6">
|
|
72
72
|
* Any kind of content can go here!
|
|
@@ -81,7 +81,7 @@ interface BoxProps extends ViewProps, SizeProps {
|
|
|
81
81
|
*
|
|
82
82
|
* @related [HStack](https://uds.build/docs/components/h-stack), [VStack](https://uds.build/docs/components/v-stack)
|
|
83
83
|
*/
|
|
84
|
-
declare const Box:
|
|
84
|
+
declare const Box: react1.NamedExoticComponent<BoxProps>;
|
|
85
85
|
//#endregion
|
|
86
86
|
export { Box, type BoxProps };
|
|
87
87
|
//# sourceMappingURL=Box.d.mts.map
|
package/dist/components/Box.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.mjs","names":["Box"],"sources":["../../src/components/Box.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { View } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\n\ninterface BoxProps extends ViewProps, SizeProps {\n ref?: Ref<View>;\n backgroundColor?: StyleProps['backgroundColor'];\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n alignContent?: StyleProps['alignContent'];\n alignItems?: StyleProps['alignItems'];\n alignSelf?: StyleProps['alignSelf'];\n flex?: StyleProps['flex'];\n flexDirection?: StyleProps['flexDirection'];\n flexGrow?: StyleProps['flexGrow'];\n flexShrink?: StyleProps['flexShrink'];\n flexWrap?: StyleProps['flexWrap'];\n justifyContent?: StyleProps['justifyContent'];\n // flexBasis?: StyleProps['flexBasis'];\n display?: StyleProps['display'];\n overflow?: StyleProps['overflow'];\n // overflowX?: StyleProps['overflowX'];\n // overflowY?: StyleProps['overflowY'];\n // position?: StyleProps['position'];\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n columnGap?: StyleProps['columnGap'];\n rowGap?: StyleProps['rowGap'];\n dangerouslySetBackgroundColor?: string;\n dangerouslySetBorderColor?: string;\n}\n\n/**\n * **📦 A layout component that can be used to compose other components**\n *\n * @description\n * The most simple component we ship - a div. But with all the power of the UDS design system.\n * By default, `Box` is a flexbox container. When working with vertical or horizontal layouts,\n * consider using [VStack](./v-stack) or [HStack](./h-stack) respectively.\n *\n * @example\n * ```tsx\n * import { Box } from '@yahoo/uds';\n *\n * <Box backgroundColor=\"primary\" spacing=\"6\">\n * Any kind of content can go here!\n * </Box>\n * ```\n *\n * @usage\n * - If you need to div-like container to apply padding, shapes, or other styling.\n * - If you're creating card components.\n *\n * @see The {@link https://uds.build/docs/components/box Box Docs} for more info\n *\n * @related [HStack](https://uds.build/docs/components/h-stack), [VStack](https://uds.build/docs/components/v-stack)\n */\nconst Box = memo(function Box({\n // background\n backgroundColor,\n dangerouslySetBackgroundColor,\n // border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n dangerouslySetBorderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // flex\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // flexBasis,\n // layout\n display = 'flex',\n overflow,\n // overflowX,\n // overflowY,\n // position,\n // spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n columnGap,\n rowGap,\n // size\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n // // shadow\n // dropShadow,\n // insetShadow,\n // // nested border radius\n // nestedBorderRadius,\n // nestedBorderRadiusSize = nestedBorderRadius ? borderRadius : undefined,\n // nestedBorderRadiusSpacing = nestedBorderRadius ? spacing : undefined,\n // nestedBorderRadiusWidth = nestedBorderRadius ? borderWidth : undefined,\n // style - extracted to merge with variants\n style,\n ref,\n // rest\n ...props\n}: BoxProps) {\n const variants = {\n // background\n backgroundColor,\n // border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n // nestedBorderRadius,\n // nestedBorderRadiusSize,\n // nestedBorderRadiusSpacing,\n // nestedBorderRadiusWidth,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // flex\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // flexBasis,\n // layout\n display,\n overflow,\n // overflowX,\n // overflowY,\n // position,\n // spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n columnGap,\n rowGap,\n // rest\n };\n\n styles.useVariants(variants);\n\n // styles.foundation must be in deps - it returns a new reference when variants change\n const boxStyles = useMemo(\n () => [\n dangerouslySetBackgroundColor\n ? { backgroundColor: dangerouslySetBackgroundColor }\n : undefined,\n dangerouslySetBorderColor ? { borderColor: dangerouslySetBorderColor } : undefined,\n width ? { width } : undefined,\n height ? { height } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n styles.foundation,\n style,\n ],\n [\n dangerouslySetBackgroundColor,\n dangerouslySetBorderColor,\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n styles.foundation,\n style,\n ],\n );\n\n // Merge variant styles with user-provided style prop\n // User styles come last so they can override variant styles if needed\n return <View ref={ref} style={boxStyles} {...props} />;\n});\n\nBox.displayName = 'Box';\n\nexport { Box, type BoxProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,MAAM,MAAM,KAAK,SAASA,MAAI,EAE5B,iBACA,+BAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,2BACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,cACA,YACA,WACA,MACA,eACA,UACA,YACA,UACA,gBAGA,UAAU,QACV,UAKA,SACA,mBACA,iBACA,eACA,YACA,cACA,YACA,QACA,gBACA,kBACA,cACA,WACA,aACA,WACA,WACA,QAEA,OACA,QACA,UACA,UACA,WACA,WAUA,OACA,KAEA,GAAG,SACQ;CACX,MAAM,WAAW;EAEf;EAEA;EACA;EACA;EACA;EACA;EAKA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EAKA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAED;AAED,QAAO,YAAY,SAAS;AAkC5B,QAAO,oBAAC;EAAU;EAAK,OA/BL,cACV;GACJ,gCACI,EAAE,iBAAiB,+BAA+B,GAClD;GACJ,4BAA4B,EAAE,aAAa,2BAA2B,GAAG;GACzE,QAAQ,EAAE,OAAO,GAAG;GACpB,SAAS,EAAE,QAAQ,GAAG;GACtB,WAAW,EAAE,UAAU,GAAG;GAC1B,WAAW,EAAE,UAAU,GAAG;GAC1B,YAAY,EAAE,WAAW,GAAG;GAC5B,YAAY,EAAE,WAAW,GAAG;GAC5B,OAAO;GACP;GACD,EACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,OAAO;GACP;GACD,CACF;EAIwC,GAAI;GAAS;EACtD;AAEF,IAAI,cAAc"}
|
|
1
|
+
{"version":3,"file":"Box.mjs","names":["Box"],"sources":["../../src/components/Box.tsx"],"sourcesContent":["import type { Ref } from 'react';\nimport { memo, useMemo } from 'react';\nimport type { ViewProps } from 'react-native';\nimport { View } from 'react-native';\n\nimport type { StyleProps } from '../../generated/styles';\nimport { styles } from '../../generated/styles';\nimport type { SizeProps } from '../types';\n\ninterface BoxProps extends ViewProps, SizeProps {\n ref?: Ref<View>;\n backgroundColor?: StyleProps['backgroundColor'];\n borderRadius?: StyleProps['borderRadius'];\n borderTopStartRadius?: StyleProps['borderTopStartRadius'];\n borderTopEndRadius?: StyleProps['borderTopEndRadius'];\n borderBottomStartRadius?: StyleProps['borderBottomStartRadius'];\n borderBottomEndRadius?: StyleProps['borderBottomEndRadius'];\n borderColor?: StyleProps['borderColor'];\n borderStartColor?: StyleProps['borderStartColor'];\n borderEndColor?: StyleProps['borderEndColor'];\n borderTopColor?: StyleProps['borderTopColor'];\n borderBottomColor?: StyleProps['borderBottomColor'];\n borderWidth?: StyleProps['borderWidth'];\n borderVerticalWidth?: StyleProps['borderVerticalWidth'];\n borderHorizontalWidth?: StyleProps['borderHorizontalWidth'];\n borderStartWidth?: StyleProps['borderStartWidth'];\n borderEndWidth?: StyleProps['borderEndWidth'];\n borderTopWidth?: StyleProps['borderTopWidth'];\n borderBottomWidth?: StyleProps['borderBottomWidth'];\n alignContent?: StyleProps['alignContent'];\n alignItems?: StyleProps['alignItems'];\n alignSelf?: StyleProps['alignSelf'];\n flex?: StyleProps['flex'];\n flexDirection?: StyleProps['flexDirection'];\n flexGrow?: StyleProps['flexGrow'];\n flexShrink?: StyleProps['flexShrink'];\n flexWrap?: StyleProps['flexWrap'];\n justifyContent?: StyleProps['justifyContent'];\n // flexBasis?: StyleProps['flexBasis'];\n display?: StyleProps['display'];\n overflow?: StyleProps['overflow'];\n // overflowX?: StyleProps['overflowX'];\n // overflowY?: StyleProps['overflowY'];\n // position?: StyleProps['position'];\n spacing?: StyleProps['spacing'];\n spacingHorizontal?: StyleProps['spacingHorizontal'];\n spacingVertical?: StyleProps['spacingVertical'];\n spacingBottom?: StyleProps['spacingBottom'];\n spacingEnd?: StyleProps['spacingEnd'];\n spacingStart?: StyleProps['spacingStart'];\n spacingTop?: StyleProps['spacingTop'];\n offset?: StyleProps['offset'];\n offsetVertical?: StyleProps['offsetVertical'];\n offsetHorizontal?: StyleProps['offsetHorizontal'];\n offsetBottom?: StyleProps['offsetBottom'];\n offsetEnd?: StyleProps['offsetEnd'];\n offsetStart?: StyleProps['offsetStart'];\n offsetTop?: StyleProps['offsetTop'];\n columnGap?: StyleProps['columnGap'];\n rowGap?: StyleProps['rowGap'];\n dangerouslySetBackgroundColor?: string;\n dangerouslySetBorderColor?: string;\n}\n\n/**\n * **📦 A layout component that can be used to compose other components**\n *\n * @description\n * The most simple component we ship - a div. But with all the power of the UDS design system.\n * By default, `Box` is a flexbox container. When working with vertical or horizontal layouts,\n * consider using [VStack](./v-stack) or [HStack](./h-stack) respectively.\n *\n * @example\n * ```tsx\n * import { Box } from '@yahoo/uds-mobile/Box';\n *\n * <Box backgroundColor=\"primary\" spacing=\"6\">\n * Any kind of content can go here!\n * </Box>\n * ```\n *\n * @usage\n * - If you need to div-like container to apply padding, shapes, or other styling.\n * - If you're creating card components.\n *\n * @see The {@link https://uds.build/docs/components/box Box Docs} for more info\n *\n * @related [HStack](https://uds.build/docs/components/h-stack), [VStack](https://uds.build/docs/components/v-stack)\n */\nconst Box = memo(function Box({\n // background\n backgroundColor,\n dangerouslySetBackgroundColor,\n // border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n borderColor,\n dangerouslySetBorderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // flex\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // flexBasis,\n // layout\n display = 'flex',\n overflow,\n // overflowX,\n // overflowY,\n // position,\n // spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n columnGap,\n rowGap,\n // size\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n // // shadow\n // dropShadow,\n // insetShadow,\n // // nested border radius\n // nestedBorderRadius,\n // nestedBorderRadiusSize = nestedBorderRadius ? borderRadius : undefined,\n // nestedBorderRadiusSpacing = nestedBorderRadius ? spacing : undefined,\n // nestedBorderRadiusWidth = nestedBorderRadius ? borderWidth : undefined,\n // style - extracted to merge with variants\n style,\n ref,\n // rest\n ...props\n}: BoxProps) {\n const variants = {\n // background\n backgroundColor,\n // border\n borderRadius,\n borderTopStartRadius,\n borderTopEndRadius,\n borderBottomStartRadius,\n borderBottomEndRadius,\n // nestedBorderRadius,\n // nestedBorderRadiusSize,\n // nestedBorderRadiusSpacing,\n // nestedBorderRadiusWidth,\n borderColor,\n borderStartColor,\n borderEndColor,\n borderTopColor,\n borderBottomColor,\n borderWidth,\n borderVerticalWidth,\n borderHorizontalWidth,\n borderStartWidth,\n borderEndWidth,\n borderTopWidth,\n borderBottomWidth,\n // flex\n alignContent,\n alignItems,\n alignSelf,\n flex,\n flexDirection,\n flexGrow,\n flexShrink,\n flexWrap,\n justifyContent,\n // flexBasis,\n // layout\n display,\n overflow,\n // overflowX,\n // overflowY,\n // position,\n // spacing\n spacing,\n spacingHorizontal,\n spacingVertical,\n spacingBottom,\n spacingEnd,\n spacingStart,\n spacingTop,\n offset,\n offsetVertical,\n offsetHorizontal,\n offsetBottom,\n offsetEnd,\n offsetStart,\n offsetTop,\n columnGap,\n rowGap,\n // rest\n };\n\n styles.useVariants(variants);\n\n // styles.foundation must be in deps - it returns a new reference when variants change\n const boxStyles = useMemo(\n () => [\n dangerouslySetBackgroundColor\n ? { backgroundColor: dangerouslySetBackgroundColor }\n : undefined,\n dangerouslySetBorderColor ? { borderColor: dangerouslySetBorderColor } : undefined,\n width ? { width } : undefined,\n height ? { height } : undefined,\n minWidth ? { minWidth } : undefined,\n maxWidth ? { maxWidth } : undefined,\n minHeight ? { minHeight } : undefined,\n maxHeight ? { maxHeight } : undefined,\n styles.foundation,\n style,\n ],\n [\n dangerouslySetBackgroundColor,\n dangerouslySetBorderColor,\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n styles.foundation,\n style,\n ],\n );\n\n // Merge variant styles with user-provided style prop\n // User styles come last so they can override variant styles if needed\n return <View ref={ref} style={boxStyles} {...props} />;\n});\n\nBox.displayName = 'Box';\n\nexport { Box, type BoxProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,MAAM,MAAM,KAAK,SAASA,MAAI,EAE5B,iBACA,+BAEA,cACA,sBACA,oBACA,yBACA,uBACA,aACA,2BACA,kBACA,gBACA,gBACA,mBACA,aACA,qBACA,uBACA,kBACA,gBACA,gBACA,mBAEA,cACA,YACA,WACA,MACA,eACA,UACA,YACA,UACA,gBAGA,UAAU,QACV,UAKA,SACA,mBACA,iBACA,eACA,YACA,cACA,YACA,QACA,gBACA,kBACA,cACA,WACA,aACA,WACA,WACA,QAEA,OACA,QACA,UACA,UACA,WACA,WAUA,OACA,KAEA,GAAG,SACQ;CACX,MAAM,WAAW;EAEf;EAEA;EACA;EACA;EACA;EACA;EAKA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EAKA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAED;AAED,QAAO,YAAY,SAAS;AAkC5B,QAAO,oBAAC;EAAU;EAAK,OA/BL,cACV;GACJ,gCACI,EAAE,iBAAiB,+BAA+B,GAClD;GACJ,4BAA4B,EAAE,aAAa,2BAA2B,GAAG;GACzE,QAAQ,EAAE,OAAO,GAAG;GACpB,SAAS,EAAE,QAAQ,GAAG;GACtB,WAAW,EAAE,UAAU,GAAG;GAC1B,WAAW,EAAE,UAAU,GAAG;GAC1B,YAAY,EAAE,WAAW,GAAG;GAC5B,YAAY,EAAE,WAAW,GAAG;GAC5B,OAAO;GACP;GACD,EACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,OAAO;GACP;GACD,CACF;EAIwC,GAAI;GAAS;EACtD;AAEF,IAAI,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const
|
|
4
|
-
const require_motion
|
|
3
|
+
const require_index = require('../motion-tokens/dist/index.cjs');
|
|
4
|
+
const require_motion = require('../motion.cjs');
|
|
5
5
|
const require_components_IconSlot = require('./IconSlot.cjs');
|
|
6
6
|
const require_components_Text = require('./Text.cjs');
|
|
7
7
|
const require_components_Pressable = require('./Pressable.cjs');
|
|
@@ -32,7 +32,7 @@ function interpolateShadowAlpha(shadow, alpha) {
|
|
|
32
32
|
* Uses staggered animation: opacity waits until halfway through width animation.
|
|
33
33
|
*/
|
|
34
34
|
function AnimatedIconSlot({ children, visible, iconSize, gap }) {
|
|
35
|
-
const progress = (0, react_native_reanimated.useDerivedValue)(() => (0, react_native_reanimated.withSpring)(visible ? 1 : 0, require_motion
|
|
35
|
+
const progress = (0, react_native_reanimated.useDerivedValue)(() => (0, react_native_reanimated.withSpring)(visible ? 1 : 0, require_motion.BUTTON_SPRING_CONFIG), [visible]);
|
|
36
36
|
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
37
37
|
const totalWidth = iconSize + gap;
|
|
38
38
|
return {
|
|
@@ -82,10 +82,10 @@ const Button = (0, react.memo)(function Button$1({ variant = "primary", size = "
|
|
|
82
82
|
const buttonGap = generated_styles.buttonStyles.root.gap;
|
|
83
83
|
const iconSize = generated_styles.buttonStyles.icon.fontSize;
|
|
84
84
|
const animatedTheme = (0, react_native_unistyles_reanimated.useAnimatedTheme)();
|
|
85
|
-
const scale = (0, react_native_reanimated.useSharedValue)(
|
|
85
|
+
const scale = (0, react_native_reanimated.useSharedValue)(require_index.SCALE_EFFECTS.none);
|
|
86
86
|
const handlePressIn = (0, react.useCallback)((event) => {
|
|
87
87
|
setPressed(true);
|
|
88
|
-
if (shouldAnimate) scale.value = (0, react_native_reanimated.withSpring)(
|
|
88
|
+
if (shouldAnimate) scale.value = (0, react_native_reanimated.withSpring)(require_index.SCALE_EFFECTS.down, require_motion.BUTTON_SPRING_CONFIG);
|
|
89
89
|
onPressIn?.(event);
|
|
90
90
|
}, [
|
|
91
91
|
shouldAnimate,
|
|
@@ -94,7 +94,7 @@ const Button = (0, react.memo)(function Button$1({ variant = "primary", size = "
|
|
|
94
94
|
]);
|
|
95
95
|
const handlePressOut = (0, react.useCallback)((event) => {
|
|
96
96
|
setPressed(false);
|
|
97
|
-
if (shouldAnimate) scale.value = (0, react_native_reanimated.withSpring)(
|
|
97
|
+
if (shouldAnimate) scale.value = (0, react_native_reanimated.withSpring)(require_index.SCALE_EFFECTS.none, require_motion.BUTTON_SPRING_CONFIG);
|
|
98
98
|
onPressOut?.(event);
|
|
99
99
|
}, [
|
|
100
100
|
shouldAnimate,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { IconVariant } from "../
|
|
3
|
-
import { ButtonSize, ButtonVariantFlat } from "../uds/dist/tokens/types.cjs";
|
|
2
|
+
import { ButtonSize, ButtonVariantFlat, IconVariant } from "../types/dist/index.cjs";
|
|
4
3
|
import { IconSlotType } from "./IconSlot.cjs";
|
|
5
4
|
import { PressableProps as PressableProps$1 } from "./Pressable.cjs";
|
|
6
|
-
import * as
|
|
5
|
+
import * as react2 from "react";
|
|
7
6
|
import { Ref } from "react";
|
|
8
7
|
import { View } from "react-native";
|
|
9
8
|
|
|
@@ -50,7 +49,7 @@ interface ButtonProps extends Omit<PressableProps$1, 'children' | 'disabled'> {
|
|
|
50
49
|
*
|
|
51
50
|
* @see The {@link https://uds.build/docs/components/button Button Docs} for more info
|
|
52
51
|
*/
|
|
53
|
-
declare const Button:
|
|
52
|
+
declare const Button: react2.NamedExoticComponent<ButtonProps>;
|
|
54
53
|
//#endregion
|
|
55
54
|
export { Button, type ButtonProps };
|
|
56
55
|
//# sourceMappingURL=Button.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.cts","names":[],"sources":["../../src/components/Button.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.cts","names":[],"sources":["../../src/components/Button.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;UA2GU,WAAA,SAAoB,KAAK;;YAEvB;EAFF;EAAyB,IAAA,CAAA,EAI1B,UAJ0B;EAEvB;EAEH,WAAA,CAAA,EAEO,WAFP;EAEO,SAAA,CAAA,EACF,YADE;EACF,OAAA,CAAA,EACF,YADE;EACF,OAAA,CAAA,EAAA,OAAA;EAGC,QAAM,CAAA,EAAA,OAAA;EAMP,QAAA,CAAA,EANC,KAAA,CAAM,SAMP;EAAJ;;;AAjB0B;;QAiB1B,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;cA8BN,QAAM,MAAA,CAAA,qBAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { IconVariant } from "../
|
|
3
|
-
import { ButtonSize, ButtonVariantFlat } from "../uds/dist/tokens/types.mjs";
|
|
2
|
+
import { ButtonSize, ButtonVariantFlat, IconVariant } from "../types/dist/index.mjs";
|
|
4
3
|
import { IconSlotType } from "./IconSlot.mjs";
|
|
5
4
|
import { PressableProps as PressableProps$1 } from "./Pressable.mjs";
|
|
6
|
-
import * as
|
|
5
|
+
import * as react2 from "react";
|
|
7
6
|
import { Ref } from "react";
|
|
8
7
|
import { View } from "react-native";
|
|
9
8
|
|
|
@@ -50,7 +49,7 @@ interface ButtonProps extends Omit<PressableProps$1, 'children' | 'disabled'> {
|
|
|
50
49
|
*
|
|
51
50
|
* @see The {@link https://uds.build/docs/components/button Button Docs} for more info
|
|
52
51
|
*/
|
|
53
|
-
declare const Button:
|
|
52
|
+
declare const Button: react2.NamedExoticComponent<ButtonProps>;
|
|
54
53
|
//#endregion
|
|
55
54
|
export { Button, type ButtonProps };
|
|
56
55
|
//# sourceMappingURL=Button.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.mts","names":[],"sources":["../../src/components/Button.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.mts","names":[],"sources":["../../src/components/Button.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;UA2GU,WAAA,SAAoB,KAAK;;YAEvB;EAFF;EAAyB,IAAA,CAAA,EAI1B,UAJ0B;EAEvB;EAEH,WAAA,CAAA,EAEO,WAFP;EAEO,SAAA,CAAA,EACF,YADE;EACF,OAAA,CAAA,EACF,YADE;EACF,OAAA,CAAA,EAAA,OAAA;EAGC,QAAM,CAAA,EAAA,OAAA;EAMP,QAAA,CAAA,EANC,KAAA,CAAM,SAMP;EAAJ;;;AAjB0B;;QAiB1B,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;cA8BN,QAAM,MAAA,CAAA,qBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
-
import { SCALE_EFFECTS } from "../
|
|
2
|
+
import { SCALE_EFFECTS } from "../motion-tokens/dist/index.mjs";
|
|
3
3
|
import { BUTTON_SPRING_CONFIG } from "../motion.mjs";
|
|
4
4
|
import { IconSlot } from "./IconSlot.mjs";
|
|
5
5
|
import { Text as Text$1 } from "./Text.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","names":["Button","Text"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonSize, ButtonVariantFlat, IconVariant } from '@yahoo/uds/tokens';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\nimport { ActivityIndicator } from 'react-native';\nimport Animated, {\n Easing,\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated';\nimport { useAnimatedTheme } from 'react-native-unistyles/reanimated';\n\nimport { buttonStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { PressableProps } from './Pressable';\nimport { AnimatedPressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Animation Helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Interpolates a boxShadow string by scaling the alpha of all colors.\n * This allows smooth fade-in/out of shadows.\n */\nfunction interpolateShadowAlpha(shadow: string, alpha: number): string {\n 'worklet';\n if (!shadow || alpha >= 1) {\n return shadow;\n }\n if (alpha <= 0) {\n return '';\n }\n\n return shadow.replace(/rgba\\(([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^)]+)\\)/g, (_, r, g, b, a) => {\n const newAlpha = parseFloat(a) * alpha;\n return `rgba(${r}, ${g}, ${b}, ${newAlpha.toFixed(3)})`;\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Animated Icon Slot */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Animated wrapper for icon/loading content.\n * Matches web Button icon animation: scale 0.7→1, opacity 0→1, width 0→auto\n * Uses staggered animation: opacity waits until halfway through width animation.\n */\nfunction AnimatedIconSlot({\n children,\n visible,\n iconSize,\n gap,\n}: {\n children: React.ReactNode;\n visible: boolean;\n iconSize: number;\n gap: number;\n}) {\n // Use useDerivedValue instead of useEffect + useSharedValue\n // This is the idiomatic Reanimated pattern for deriving animated values from React state\n const progress = useDerivedValue(\n () => withSpring(visible ? 1 : 0, BUTTON_SPRING_CONFIG),\n [visible],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n // Total width includes icon + gap when visible\n const totalWidth = iconSize + gap;\n const width = interpolate(progress.value, [0, 1], [0, totalWidth]);\n\n // Staggered animation: opacity starts at 50% of width animation\n // On enter: width expands first, then icon fades in\n // On exit: icon fades out first, then width collapses\n const opacity = interpolate(progress.value, [0.5, 1], [0, 1], 'clamp');\n const scale = interpolate(progress.value, [0.5, 1], [0.7, 1], 'clamp');\n\n return {\n width,\n opacity,\n transform: [{ scale }],\n overflow: 'hidden' as const,\n };\n });\n\n return <Animated.View style={animatedStyle}>{children}</Animated.View>;\n}\n\n// function LoadingIcon({ size, variant }: { size: ButtonSize, variant: ButtonVariantFlat }) {\n// const { theme } = useUnistyles();\n// const themeKey = `buttonVariant${variantToCapitalMap[variant]}IconRest` as const;\n// const iconSize = theme.components.buttonSizeLgIconRest.fontSize;\n// return <ActivityIndicator size={iconSize} color={theme.colors.text.primary} />;\n// }\n\n/* -------------------------------------------------------------------------- */\n/* Button Props */\n/* -------------------------------------------------------------------------- */\n\ninterface ButtonProps extends Omit<PressableProps, 'children' | 'disabled'> {\n /** @default 'primary' */\n variant?: ButtonVariantFlat;\n /** @default 'md' */\n size?: ButtonSize;\n /** @default 'outline' */\n iconVariant?: IconVariant;\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\n loading?: boolean;\n disabled?: boolean;\n children?: React.ReactNode;\n /**\n * Disable motion effects (scale on press, icon animations)\n * @default false\n */\n disableEffects?: boolean;\n ref?: Ref<View>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Button Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **🖲️ A button element that can be used to trigger an action**\n *\n * @description\n * A button is a fundamental component used to trigger an action or event.\n * Buttons are interactive elements that users can click, tap, or otherwise\n * engage with to submit forms, open dialogues, or perform any other interaction.\n *\n * Features animated scale effect on press and smooth icon transitions matching\n * the web UDS Button behavior.\n *\n * @example\n * ```tsx\n * import { Button } from '@yahoo/uds-mobile';\n *\n * <Button onPress={() => console.log('pressed')}>Save</Button>\n * <Button variant=\"secondary\">Cancel</Button>\n * <Button startIcon=\"Add\" variant=\"brand\">Add Item</Button>\n * <Button loading>Saving...</Button>\n * ```\n *\n * @see The {@link https://uds.build/docs/components/button Button Docs} for more info\n */\nconst Button = memo(function Button({\n variant = 'primary',\n size = 'md',\n iconVariant = 'outline',\n startIcon,\n endIcon,\n loading,\n disabled,\n width: _width,\n children,\n style,\n accessibilityLabel,\n accessibilityHint,\n disableEffects = false,\n onPressIn,\n onPressOut,\n ref,\n ...props\n}: ButtonProps) {\n const shouldAnimate = !disableEffects;\n\n /* --------------------------------- State ---------------------------------- */\n const [pressed, setPressed] = useState(false);\n\n buttonStyles.useVariants({ size, variant, disabled, pressed });\n\n // Get gap and icon size from current variant styles\n const buttonGap = buttonStyles.root.gap;\n const iconSize = buttonStyles.icon.fontSize;\n\n // Get animated theme for boxShadow (useAnimatedVariantColor doesn't support non-color props)\n const animatedTheme = useAnimatedTheme();\n\n /* ------------------------------- Animation -------------------------------- */\n const scale = useSharedValue<number>(SCALE_EFFECTS.none);\n\n const handlePressIn = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressIn']>>[0]) => {\n setPressed(true);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.down, BUTTON_SPRING_CONFIG);\n }\n onPressIn?.(event);\n },\n [shouldAnimate, scale, onPressIn],\n );\n\n const handlePressOut = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressOut']>>[0]) => {\n setPressed(false);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG);\n }\n onPressOut?.(event);\n },\n [shouldAnimate, scale, onPressOut],\n );\n\n /* -------------------------------- Content --------------------------------- */\n const childrenNode =\n children &&\n (isValidElement(children) ? (\n children\n ) : (\n <Text numberOfLines={1} textAlign=\"center\" style={buttonStyles.text}>\n {children}\n </Text>\n ));\n\n const a11yState = useMemo(() => ({ disabled, busy: loading }), [disabled, loading]);\n\n /* --------------------------------- Styles --------------------------------- */\n // Animate pressed state for shadow (0 = rest, 1 = pressed)\n const pressProgress = useDerivedValue(\n () => withTiming(pressed ? 1 : 0, { duration: 220, easing: Easing.bezier(0, 0, 0.2, 1) }),\n [pressed],\n );\n\n // Animate using Unistyles' variant color system + boxShadow from theme\n const animatedStyles = useAnimatedStyle(() => {\n // Get boxShadow from theme using flattened path (no camelCase conversion needed!)\n const components = animatedTheme.value.components;\n const buttonVariantPath = `button/variant/${variant}/root/pressed` as const;\n const shadowPressed = components[buttonVariantPath].boxShadow;\n\n return {\n transform: [{ scale: scale.value }],\n // backgroundColor: withTiming(backgroundColor.value, {\n // duration: 220,\n // easing: Easing.bezier(0, 0, 0.2, 1),\n // }),\n // borderColor: withTiming(borderColor.value, {\n // duration: 220,\n // easing: Easing.bezier(0, 0, 0.2, 1),\n // }),\n // Animate shadow by interpolating its color alpha\n boxShadow: interpolateShadowAlpha(shadowPressed, pressProgress.value),\n };\n });\n\n // Determine what should be visible in start slot\n const showLoading = !!loading;\n const showStartIcon = !!startIcon && !loading;\n const showEndIcon = !!endIcon && !loading;\n\n // Start slot: either loading spinner or start icon\n const startContent = (\n <AnimatedIconSlot visible={showLoading || showStartIcon} iconSize={iconSize} gap={buttonGap}>\n {showLoading ? (\n <ActivityIndicator size={buttonStyles.icon.fontSize} color={buttonStyles.icon.color} />\n ) : (\n <IconSlot icon={startIcon} variant={iconVariant} style={buttonStyles.icon} />\n )}\n </AnimatedIconSlot>\n );\n\n // End slot: only end icon (no loading here)\n const endContent = (\n <AnimatedIconSlot visible={showEndIcon} iconSize={iconSize} gap={buttonGap}>\n <IconSlot icon={endIcon} variant={iconVariant} style={buttonStyles.icon} />\n </AnimatedIconSlot>\n );\n\n const rootStyles = useMemo(\n () => [\n buttonStyles.root,\n animatedStyles,\n typeof style === 'function' ? style({ pressed }) : style,\n ],\n [buttonStyles.root, animatedStyles, style, pressed],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <AnimatedPressable\n ref={ref}\n disabled={disabled}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n overflow=\"hidden\"\n accessibilityLabel={loading ? `${accessibilityLabel ?? ''}, loading` : accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole=\"button\"\n accessibilityState={a11yState}\n alignContent=\"center\"\n style={rootStyles}\n {...props}\n >\n {startContent}\n {childrenNode}\n {endContent}\n </AnimatedPressable>\n );\n});\n\nButton.displayName = 'Button';\n\nexport { Button, type ButtonProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAS,uBAAuB,QAAgB,OAAuB;AACrE;AACA,KAAI,CAAC,UAAU,SAAS,EACtB,QAAO;AAET,KAAI,SAAS,EACX,QAAO;AAGT,QAAO,OAAO,QAAQ,sDAAsD,GAAG,GAAG,GAAG,GAAG,MAAM;AAE5F,SAAO,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KADZ,WAAW,EAAE,GAAG,OACS,QAAQ,EAAE,CAAC;GACrD;;;;;;;AAYJ,SAAS,iBAAiB,EACxB,UACA,SACA,UACA,OAMC;CAGD,MAAM,WAAW,sBACT,WAAW,UAAU,IAAI,GAAG,qBAAqB,EACvD,CAAC,QAAQ,CACV;CAED,MAAM,gBAAgB,uBAAuB;EAE3C,MAAM,aAAa,WAAW;AAS9B,SAAO;GACL,OATY,YAAY,SAAS,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,WAAW,CAAC;GAUhE,SALc,YAAY,SAAS,OAAO,CAAC,IAAK,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,QAAQ;GAMpE,WAAW,CAAC,EAAE,OALF,YAAY,SAAS,OAAO,CAAC,IAAK,EAAE,EAAE,CAAC,IAAK,EAAE,EAAE,QAAQ,EAK/C,CAAC;GACtB,UAAU;GACX;GACD;AAEF,QAAO,oBAAC,SAAS;EAAK,OAAO;EAAgB;GAAyB;;;;;;;;;;;;;;;;;;;;;;;;;AA6DxE,MAAM,SAAS,KAAK,SAASA,SAAO,EAClC,UAAU,WACV,OAAO,MACP,cAAc,WACd,WACA,SACA,SACA,UACA,OAAO,QACP,UACA,OACA,oBACA,mBACA,iBAAiB,OACjB,WACA,YACA,KACA,GAAG,SACW;CACd,MAAM,gBAAgB,CAAC;CAGvB,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;AAE7C,cAAa,YAAY;EAAE;EAAM;EAAS;EAAU;EAAS,CAAC;CAG9D,MAAM,YAAY,aAAa,KAAK;CACpC,MAAM,WAAW,aAAa,KAAK;CAGnC,MAAM,gBAAgB,kBAAkB;CAGxC,MAAM,QAAQ,eAAuB,cAAc,KAAK;CAExD,MAAM,gBAAgB,aACnB,UAAmE;AAClE,aAAW,KAAK;AAChB,MAAI,cACF,OAAM,QAAQ,WAAW,cAAc,MAAM,qBAAqB;AAEpE,cAAY,MAAM;IAEpB;EAAC;EAAe;EAAO;EAAU,CAClC;CAED,MAAM,iBAAiB,aACpB,UAAoE;AACnE,aAAW,MAAM;AACjB,MAAI,cACF,OAAM,QAAQ,WAAW,cAAc,MAAM,qBAAqB;AAEpE,eAAa,MAAM;IAErB;EAAC;EAAe;EAAO;EAAW,CACnC;CAGD,MAAM,eACJ,aACC,eAAe,SAAS,GACvB,WAEA,oBAACC;EAAK,eAAe;EAAG,WAAU;EAAS,OAAO,aAAa;EAC5D;GACI;CAGX,MAAM,YAAY,eAAe;EAAE;EAAU,MAAM;EAAS,GAAG,CAAC,UAAU,QAAQ,CAAC;CAInF,MAAM,gBAAgB,sBACd,WAAW,UAAU,IAAI,GAAG;EAAE,UAAU;EAAK,QAAQ,OAAO,OAAO,GAAG,GAAG,IAAK,EAAE;EAAE,CAAC,EACzF,CAAC,QAAQ,CACV;CAGD,MAAM,iBAAiB,uBAAuB;EAI5C,MAAM,gBAFa,cAAc,MAAM,WACb,kBAAkB,QAAQ,gBACA;AAEpD,SAAO;GACL,WAAW,CAAC,EAAE,OAAO,MAAM,OAAO,CAAC;GAUnC,WAAW,uBAAuB,eAAe,cAAc,MAAM;GACtE;GACD;CAGF,MAAM,cAAc,CAAC,CAAC;CACtB,MAAM,gBAAgB,CAAC,CAAC,aAAa,CAAC;CACtC,MAAM,cAAc,CAAC,CAAC,WAAW,CAAC;CAGlC,MAAM,eACJ,oBAAC;EAAiB,SAAS,eAAe;EAAyB;EAAU,KAAK;YAC/E,cACC,oBAAC;GAAkB,MAAM,aAAa,KAAK;GAAU,OAAO,aAAa,KAAK;IAAS,GAEvF,oBAAC;GAAS,MAAM;GAAW,SAAS;GAAa,OAAO,aAAa;IAAQ;GAE9D;CAIrB,MAAM,aACJ,oBAAC;EAAiB,SAAS;EAAuB;EAAU,KAAK;YAC/D,oBAAC;GAAS,MAAM;GAAS,SAAS;GAAa,OAAO,aAAa;IAAQ;GAC1D;CAGrB,MAAM,aAAa,cACX;EACJ,aAAa;EACb;EACA,OAAO,UAAU,aAAa,MAAM,EAAE,SAAS,CAAC,GAAG;EACpD,EACD;EAAC,aAAa;EAAM;EAAgB;EAAO;EAAQ,CACpD;AAGD,QACE,qBAAC;EACM;EACK;EACV,WAAW;EACX,YAAY;EACZ,eAAc;EACd,YAAW;EACX,gBAAe;EACf,UAAS;EACT,oBAAoB,UAAU,GAAG,sBAAsB,GAAG,aAAa;EACpD;EACnB,mBAAkB;EAClB,oBAAoB;EACpB,cAAa;EACb,OAAO;EACP,GAAI;;GAEH;GACA;GACA;;GACiB;EAEtB;AAEF,OAAO,cAAc"}
|
|
1
|
+
{"version":3,"file":"Button.mjs","names":["Button","Text"],"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonSize, ButtonVariantFlat, IconVariant } from '@yahoo/uds-types';\nimport type { Ref } from 'react';\nimport { isValidElement, memo, useCallback, useMemo, useState } from 'react';\nimport type { View } from 'react-native';\nimport { ActivityIndicator } from 'react-native';\nimport Animated, {\n Easing,\n interpolate,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated';\nimport { useAnimatedTheme } from 'react-native-unistyles/reanimated';\n\nimport { buttonStyles } from '../../generated/styles';\nimport { BUTTON_SPRING_CONFIG, SCALE_EFFECTS } from '../motion';\nimport type { IconSlotType } from './IconSlot';\nimport { IconSlot } from './IconSlot';\nimport type { PressableProps } from './Pressable';\nimport { AnimatedPressable } from './Pressable';\nimport { Text } from './Text';\n\n/* -------------------------------------------------------------------------- */\n/* Animation Helpers */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Interpolates a boxShadow string by scaling the alpha of all colors.\n * This allows smooth fade-in/out of shadows.\n */\nfunction interpolateShadowAlpha(shadow: string, alpha: number): string {\n 'worklet';\n if (!shadow || alpha >= 1) {\n return shadow;\n }\n if (alpha <= 0) {\n return '';\n }\n\n return shadow.replace(/rgba\\(([^,]+),\\s*([^,]+),\\s*([^,]+),\\s*([^)]+)\\)/g, (_, r, g, b, a) => {\n const newAlpha = parseFloat(a) * alpha;\n return `rgba(${r}, ${g}, ${b}, ${newAlpha.toFixed(3)})`;\n });\n}\n\n/* -------------------------------------------------------------------------- */\n/* Animated Icon Slot */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Animated wrapper for icon/loading content.\n * Matches web Button icon animation: scale 0.7→1, opacity 0→1, width 0→auto\n * Uses staggered animation: opacity waits until halfway through width animation.\n */\nfunction AnimatedIconSlot({\n children,\n visible,\n iconSize,\n gap,\n}: {\n children: React.ReactNode;\n visible: boolean;\n iconSize: number;\n gap: number;\n}) {\n // Use useDerivedValue instead of useEffect + useSharedValue\n // This is the idiomatic Reanimated pattern for deriving animated values from React state\n const progress = useDerivedValue(\n () => withSpring(visible ? 1 : 0, BUTTON_SPRING_CONFIG),\n [visible],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n // Total width includes icon + gap when visible\n const totalWidth = iconSize + gap;\n const width = interpolate(progress.value, [0, 1], [0, totalWidth]);\n\n // Staggered animation: opacity starts at 50% of width animation\n // On enter: width expands first, then icon fades in\n // On exit: icon fades out first, then width collapses\n const opacity = interpolate(progress.value, [0.5, 1], [0, 1], 'clamp');\n const scale = interpolate(progress.value, [0.5, 1], [0.7, 1], 'clamp');\n\n return {\n width,\n opacity,\n transform: [{ scale }],\n overflow: 'hidden' as const,\n };\n });\n\n return <Animated.View style={animatedStyle}>{children}</Animated.View>;\n}\n\n// function LoadingIcon({ size, variant }: { size: ButtonSize, variant: ButtonVariantFlat }) {\n// const { theme } = useUnistyles();\n// const themeKey = `buttonVariant${variantToCapitalMap[variant]}IconRest` as const;\n// const iconSize = theme.components.buttonSizeLgIconRest.fontSize;\n// return <ActivityIndicator size={iconSize} color={theme.colors.text.primary} />;\n// }\n\n/* -------------------------------------------------------------------------- */\n/* Button Props */\n/* -------------------------------------------------------------------------- */\n\ninterface ButtonProps extends Omit<PressableProps, 'children' | 'disabled'> {\n /** @default 'primary' */\n variant?: ButtonVariantFlat;\n /** @default 'md' */\n size?: ButtonSize;\n /** @default 'outline' */\n iconVariant?: IconVariant;\n startIcon?: IconSlotType;\n endIcon?: IconSlotType;\n loading?: boolean;\n disabled?: boolean;\n children?: React.ReactNode;\n /**\n * Disable motion effects (scale on press, icon animations)\n * @default false\n */\n disableEffects?: boolean;\n ref?: Ref<View>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Button Component */\n/* -------------------------------------------------------------------------- */\n\n/**\n * **🖲️ A button element that can be used to trigger an action**\n *\n * @description\n * A button is a fundamental component used to trigger an action or event.\n * Buttons are interactive elements that users can click, tap, or otherwise\n * engage with to submit forms, open dialogues, or perform any other interaction.\n *\n * Features animated scale effect on press and smooth icon transitions matching\n * the web UDS Button behavior.\n *\n * @example\n * ```tsx\n * import { Button } from '@yahoo/uds-mobile';\n *\n * <Button onPress={() => console.log('pressed')}>Save</Button>\n * <Button variant=\"secondary\">Cancel</Button>\n * <Button startIcon=\"Add\" variant=\"brand\">Add Item</Button>\n * <Button loading>Saving...</Button>\n * ```\n *\n * @see The {@link https://uds.build/docs/components/button Button Docs} for more info\n */\nconst Button = memo(function Button({\n variant = 'primary',\n size = 'md',\n iconVariant = 'outline',\n startIcon,\n endIcon,\n loading,\n disabled,\n width: _width,\n children,\n style,\n accessibilityLabel,\n accessibilityHint,\n disableEffects = false,\n onPressIn,\n onPressOut,\n ref,\n ...props\n}: ButtonProps) {\n const shouldAnimate = !disableEffects;\n\n /* --------------------------------- State ---------------------------------- */\n const [pressed, setPressed] = useState(false);\n\n buttonStyles.useVariants({ size, variant, disabled, pressed });\n\n // Get gap and icon size from current variant styles\n const buttonGap = buttonStyles.root.gap;\n const iconSize = buttonStyles.icon.fontSize;\n\n // Get animated theme for boxShadow (useAnimatedVariantColor doesn't support non-color props)\n const animatedTheme = useAnimatedTheme();\n\n /* ------------------------------- Animation -------------------------------- */\n const scale = useSharedValue<number>(SCALE_EFFECTS.none);\n\n const handlePressIn = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressIn']>>[0]) => {\n setPressed(true);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.down, BUTTON_SPRING_CONFIG);\n }\n onPressIn?.(event);\n },\n [shouldAnimate, scale, onPressIn],\n );\n\n const handlePressOut = useCallback(\n (event: Parameters<NonNullable<PressableProps['onPressOut']>>[0]) => {\n setPressed(false);\n if (shouldAnimate) {\n scale.value = withSpring(SCALE_EFFECTS.none, BUTTON_SPRING_CONFIG);\n }\n onPressOut?.(event);\n },\n [shouldAnimate, scale, onPressOut],\n );\n\n /* -------------------------------- Content --------------------------------- */\n const childrenNode =\n children &&\n (isValidElement(children) ? (\n children\n ) : (\n <Text numberOfLines={1} textAlign=\"center\" style={buttonStyles.text}>\n {children}\n </Text>\n ));\n\n const a11yState = useMemo(() => ({ disabled, busy: loading }), [disabled, loading]);\n\n /* --------------------------------- Styles --------------------------------- */\n // Animate pressed state for shadow (0 = rest, 1 = pressed)\n const pressProgress = useDerivedValue(\n () => withTiming(pressed ? 1 : 0, { duration: 220, easing: Easing.bezier(0, 0, 0.2, 1) }),\n [pressed],\n );\n\n // Animate using Unistyles' variant color system + boxShadow from theme\n const animatedStyles = useAnimatedStyle(() => {\n // Get boxShadow from theme using flattened path (no camelCase conversion needed!)\n const components = animatedTheme.value.components;\n const buttonVariantPath = `button/variant/${variant}/root/pressed` as const;\n const shadowPressed = components[buttonVariantPath].boxShadow;\n\n return {\n transform: [{ scale: scale.value }],\n // backgroundColor: withTiming(backgroundColor.value, {\n // duration: 220,\n // easing: Easing.bezier(0, 0, 0.2, 1),\n // }),\n // borderColor: withTiming(borderColor.value, {\n // duration: 220,\n // easing: Easing.bezier(0, 0, 0.2, 1),\n // }),\n // Animate shadow by interpolating its color alpha\n boxShadow: interpolateShadowAlpha(shadowPressed, pressProgress.value),\n };\n });\n\n // Determine what should be visible in start slot\n const showLoading = !!loading;\n const showStartIcon = !!startIcon && !loading;\n const showEndIcon = !!endIcon && !loading;\n\n // Start slot: either loading spinner or start icon\n const startContent = (\n <AnimatedIconSlot visible={showLoading || showStartIcon} iconSize={iconSize} gap={buttonGap}>\n {showLoading ? (\n <ActivityIndicator size={buttonStyles.icon.fontSize} color={buttonStyles.icon.color} />\n ) : (\n <IconSlot icon={startIcon} variant={iconVariant} style={buttonStyles.icon} />\n )}\n </AnimatedIconSlot>\n );\n\n // End slot: only end icon (no loading here)\n const endContent = (\n <AnimatedIconSlot visible={showEndIcon} iconSize={iconSize} gap={buttonGap}>\n <IconSlot icon={endIcon} variant={iconVariant} style={buttonStyles.icon} />\n </AnimatedIconSlot>\n );\n\n const rootStyles = useMemo(\n () => [\n buttonStyles.root,\n animatedStyles,\n typeof style === 'function' ? style({ pressed }) : style,\n ],\n [buttonStyles.root, animatedStyles, style, pressed],\n );\n\n /* --------------------------------- Render --------------------------------- */\n return (\n <AnimatedPressable\n ref={ref}\n disabled={disabled}\n onPressIn={handlePressIn}\n onPressOut={handlePressOut}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n overflow=\"hidden\"\n accessibilityLabel={loading ? `${accessibilityLabel ?? ''}, loading` : accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole=\"button\"\n accessibilityState={a11yState}\n alignContent=\"center\"\n style={rootStyles}\n {...props}\n >\n {startContent}\n {childrenNode}\n {endContent}\n </AnimatedPressable>\n );\n});\n\nButton.displayName = 'Button';\n\nexport { Button, type ButtonProps };\n"],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const
|
|
4
|
-
const require_motion
|
|
3
|
+
const require_index = require('../motion-tokens/dist/index.cjs');
|
|
4
|
+
const require_motion = require('../motion.cjs');
|
|
5
5
|
const require_components_Icon = require('./Icon.cjs');
|
|
6
6
|
const require_components_Text = require('./Text.cjs');
|
|
7
7
|
const require_components_HStack = require('./HStack.cjs');
|
|
@@ -56,8 +56,8 @@ const Checkbox = (0, react.memo)(function Checkbox$1({ label, labelPosition = "s
|
|
|
56
56
|
const iconName = valueState === "indeterminate" ? "Minus" : "Check";
|
|
57
57
|
const showIcon = valueState !== "unchecked";
|
|
58
58
|
const shouldAnimate = !reduceMotion;
|
|
59
|
-
const scaleProgress = (0, react_native_reanimated.useDerivedValue)(() => shouldAnimate ? (0, react_native_reanimated.withSpring)(pressed ?
|
|
60
|
-
const iconProgress = (0, react_native_reanimated.useDerivedValue)(() => shouldAnimate ? (0, react_native_reanimated.withSpring)(showIcon ? 1 : 0, require_motion
|
|
59
|
+
const scaleProgress = (0, react_native_reanimated.useDerivedValue)(() => shouldAnimate ? (0, react_native_reanimated.withSpring)(pressed ? require_index.SCALE_EFFECTS.down : require_index.SCALE_EFFECTS.none, require_motion.BUTTON_SPRING_CONFIG) : require_index.SCALE_EFFECTS.none, [pressed, shouldAnimate]);
|
|
60
|
+
const iconProgress = (0, react_native_reanimated.useDerivedValue)(() => shouldAnimate ? (0, react_native_reanimated.withSpring)(showIcon ? 1 : 0, require_motion.BUTTON_SPRING_CONFIG) : showIcon ? 1 : 0, [showIcon, shouldAnimate]);
|
|
61
61
|
const checkboxAnimatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ transform: [{ scale: scaleProgress.value }] }));
|
|
62
62
|
const iconAnimatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
63
63
|
opacity: (0, react_native_reanimated.interpolate)(iconProgress.value, [0, 1], [0, 1]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalCheckboxProps } from "../
|
|
3
|
-
import * as
|
|
2
|
+
import { UniversalCheckboxProps } from "../types/dist/index.cjs";
|
|
3
|
+
import * as react4 from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
|
|
|
42
42
|
*
|
|
43
43
|
* @see The {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
|
|
44
44
|
*/
|
|
45
|
-
declare const Checkbox:
|
|
45
|
+
declare const Checkbox: react4.NamedExoticComponent<CheckboxProps>;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { Checkbox, type CheckboxProps };
|
|
48
48
|
//# sourceMappingURL=Checkbox.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { UniversalCheckboxProps } from "../
|
|
3
|
-
import * as
|
|
2
|
+
import { UniversalCheckboxProps } from "../types/dist/index.mjs";
|
|
3
|
+
import * as react4 from "react";
|
|
4
4
|
import { Ref } from "react";
|
|
5
5
|
import { View, ViewProps } from "react-native";
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ interface CheckboxProps extends Omit<ViewProps, 'style'>, UniversalCheckboxProps
|
|
|
42
42
|
*
|
|
43
43
|
* @see The {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
|
|
44
44
|
*/
|
|
45
|
-
declare const Checkbox:
|
|
45
|
+
declare const Checkbox: react4.NamedExoticComponent<CheckboxProps>;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { Checkbox, type CheckboxProps };
|
|
48
48
|
//# sourceMappingURL=Checkbox.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.mts","names":[],"sources":["../../src/components/Checkbox.tsx"],"sourcesContent":[],"mappings":";;;;;;;UAyBU,aAAA,SAAsB,KAAK,qBAAqB;QAClD,IAAI;;EADF,cAAA,CAAA,EAAc,OAAA;EAAa;EACzB,QAAA,CAAA,EAAA,OAAA;EAAJ;EADwB,QAAA,CAAA,EAAA,OAAA;EAA0B;EAAsB,QAAA,CAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,GAAA,IAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsD1E,UAAQ,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.mts","names":[],"sources":["../../src/components/Checkbox.tsx"],"sourcesContent":[],"mappings":";;;;;;;UAyBU,aAAA,SAAsB,KAAK,qBAAqB;QAClD,IAAI;;EADF,cAAA,CAAA,EAAc,OAAA;EAAa;EACzB,QAAA,CAAA,EAAA,OAAA;EAAJ;EADwB,QAAA,CAAA,EAAA,OAAA;EAA0B;EAAsB,QAAA,CAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,GAAA,IAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsD1E,UAAQ,MAAA,CAAA,qBAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
-
import { SCALE_EFFECTS } from "../
|
|
2
|
+
import { SCALE_EFFECTS } from "../motion-tokens/dist/index.mjs";
|
|
3
3
|
import { BUTTON_SPRING_CONFIG } from "../motion.mjs";
|
|
4
4
|
import { Icon } from "./Icon.mjs";
|
|
5
5
|
import { Text } from "./Text.mjs";
|