@yahoo/uds 3.59.0-beta.1 → 3.59.0-beta.2
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/cli/bin/uds-darwin-arm64-baseline +0 -0
- package/cli/bin/uds-darwin-x64 +0 -0
- package/cli/bin/uds-linux-arm64 +0 -0
- package/cli/bin/uds-linux-x64-baseline +0 -0
- package/dist/components/Box.d.ts +2 -2
- package/dist/components/Box.d.ts.map +1 -1
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/DividerCore.d.cts +2 -2
- package/dist/components/Divider/DividerCore.d.ts +2 -2
- package/dist/components/Divider/DividerInternal.d.cts +2 -2
- package/dist/components/Divider/DividerInternal.d.ts +2 -2
- package/dist/components/FormLabel.d.ts +2 -2
- package/dist/components/HStack.d.ts +2 -2
- package/dist/components/Icon.d.ts +2 -2
- package/dist/components/Link.d.ts +2 -2
- package/dist/components/Text.d.cts +5 -5
- package/dist/components/Text.d.cts.map +1 -1
- package/dist/components/Text.d.ts +8 -8
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/VStack.d.ts +2 -2
- package/dist/components/VStack.d.ts.map +1 -1
- package/dist/components/client/AnimateHeightChange.d.cts +2 -2
- package/dist/components/client/AnimateHeightChange.d.ts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts +2 -2
- package/dist/components/client/Avatar/Avatar.d.cts.map +1 -1
- package/dist/components/client/Avatar/Avatar.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarIcon.d.cts.map +1 -1
- package/dist/components/client/Avatar/AvatarIcon.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarImage.d.ts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.cts +2 -2
- package/dist/components/client/Avatar/AvatarText.d.ts +2 -2
- package/dist/components/client/IconButton.d.cts +2 -2
- package/dist/components/client/IconButton.d.ts +2 -2
- package/dist/components/client/IconButton.d.ts.map +1 -1
- package/dist/components/client/Input/Input.d.cts +2 -2
- package/dist/components/client/Input/Input.d.ts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts +2 -2
- package/dist/components/client/Input/InputHelpText.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpText.d.ts +2 -2
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +4 -4
- package/dist/components/client/Input/InputHelpTextInternal.d.cts.map +1 -1
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +4 -4
- package/dist/components/client/Menu/Menu.Content.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Content.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Item.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +2 -2
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.ts +2 -2
- package/dist/components/client/Pressable.d.cts +2 -2
- package/dist/components/client/Pressable.d.ts +2 -2
- package/dist/components/client/Pressable.d.ts.map +1 -1
- package/dist/components/client/Radio/RadioGroupStore.d.ts +2 -2
- package/dist/components/client/SpringMotionConfig.d.cts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts +3 -3
- package/dist/components/client/SpringMotionConfig.d.ts.map +1 -1
- package/dist/components/experimental/Spinner.d.cts +2 -2
- package/dist/components/experimental/Spinner.d.cts.map +1 -1
- package/dist/components/experimental/Spinner.d.ts +2 -2
- package/dist/components/experimental/Table.d.cts +2 -2
- package/dist/components/experimental/Table.d.ts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts +2 -2
- package/dist/components/experimental/client/Accordion.d.cts.map +1 -1
- package/dist/components/experimental/client/Accordion.d.ts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +2 -2
- package/dist/components/experimental/client/Modal.d.cts +3 -3
- package/dist/components/experimental/client/Modal.d.cts.map +1 -1
- package/dist/components/experimental/client/Modal.d.ts +3 -3
- package/dist/components/experimental/client/Popover.d.cts +3 -3
- package/dist/components/experimental/client/Popover.d.cts.map +1 -1
- package/dist/components/experimental/client/Popover.d.ts +3 -3
- package/dist/components/experimental/client/Tabs.d.cts +3 -3
- package/dist/components/experimental/client/Tabs.d.ts +6 -6
- package/dist/components/experimental/client/Toast.d.cts +2 -2
- package/dist/components/experimental/client/Toast.d.ts +2 -2
- package/dist/providers/ColorModeProvider.d.cts +4 -4
- package/dist/providers/ColorModeProvider.d.cts.map +1 -1
- package/dist/providers/ColorModeProvider.d.ts +4 -4
- package/dist/providers/ColorModeProvider.d.ts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.cts +4 -4
- package/dist/providers/ScaleModeProvider.d.cts.map +1 -1
- package/dist/providers/ScaleModeProvider.d.ts +4 -4
- package/dist/providers/ScaleModeProvider.d.ts.map +1 -1
- package/dist/providers/ThemeProvider.d.cts +2 -2
- package/dist/providers/ThemeProvider.d.cts.map +1 -1
- package/dist/providers/ThemeProvider.d.ts +2 -2
- package/dist/styles/styler.d.cts +33 -33
- package/dist/styles/styler.d.ts +33 -33
- package/dist/styles/stylerTypes.d.ts.map +1 -1
- package/dist/tailwind/tailwind.config.d.ts +3 -3
- package/dist/tailwind/tailwindPlugin.d.ts +3 -3
- package/dist/tailwind/utils/getMotionStyles.d.cts +1 -1
- package/dist/tailwind/utils/getMotionStyles.d.ts +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.cts.map +1 -1
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/tokens/automation/utils/getConfigVariantProperties.d.ts.map +1 -1
- package/dist/tokens/types.d.cts.map +1 -1
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/utils/intersperse.d.cts +2 -2
- package/dist/utils/intersperse.d.ts +2 -2
- package/package.json +1 -3
- package/cli/FlattenButtonVariant.mock.tsx +0 -17
- package/src/components/Box.tsx +0 -181
- package/src/components/Divider/Divider.tsx +0 -44
- package/src/components/Divider/DividerCore.tsx +0 -101
- package/src/components/Divider/DividerInternal.tsx +0 -56
- package/src/components/Divider/index.ts +0 -1
- package/src/components/FormLabel.tsx +0 -66
- package/src/components/HStack.tsx +0 -53
- package/src/components/Icon.tsx +0 -82
- package/src/components/IconSlot.tsx +0 -82
- package/src/components/Image.tsx +0 -162
- package/src/components/Link.tsx +0 -134
- package/src/components/Text.tsx +0 -272
- package/src/components/VStack.tsx +0 -53
- package/src/components/client/AnimateHeightChange.tsx +0 -50
- package/src/components/client/Avatar/Avatar.tsx +0 -31
- package/src/components/client/Avatar/AvatarIcon.tsx +0 -103
- package/src/components/client/Avatar/AvatarImage.tsx +0 -147
- package/src/components/client/Avatar/AvatarText.tsx +0 -88
- package/src/components/client/Avatar/index.ts +0 -4
- package/src/components/client/Avatar/utils.ts +0 -105
- package/src/components/client/Badge.tsx +0 -133
- package/src/components/client/Button.tsx +0 -312
- package/src/components/client/Checkbox.tsx +0 -377
- package/src/components/client/Chip/Chip.tsx +0 -81
- package/src/components/client/Chip/ChipBase.tsx +0 -151
- package/src/components/client/Chip/ChipButton.tsx +0 -54
- package/src/components/client/Chip/ChipDismissible.tsx +0 -90
- package/src/components/client/Chip/ChipLink.tsx +0 -60
- package/src/components/client/Chip/ChipToggle.tsx +0 -79
- package/src/components/client/Chip/index.ts +0 -5
- package/src/components/client/IconButton.tsx +0 -198
- package/src/components/client/Input/Input.tsx +0 -323
- package/src/components/client/Input/InputHelpText.tsx +0 -52
- package/src/components/client/Input/InputHelpTextInternal.tsx +0 -81
- package/src/components/client/Input/index.ts +0 -2
- package/src/components/client/Menu/Menu.Content.tsx +0 -391
- package/src/components/client/Menu/Menu.Divider.tsx +0 -102
- package/src/components/client/Menu/Menu.Item.tsx +0 -114
- package/src/components/client/Menu/Menu.ItemBase.tsx +0 -265
- package/src/components/client/Menu/Menu.ItemCheckbox.tsx +0 -197
- package/src/components/client/Menu/Menu.Provider.tsx +0 -154
- package/src/components/client/Menu/Menu.Trigger.tsx +0 -119
- package/src/components/client/Menu/Menu.index.tsx +0 -9
- package/src/components/client/Menu/Menu.tsx +0 -2
- package/src/components/client/Menu/index.ts +0 -7
- package/src/components/client/Menu/utils/transformAriakitPlacement.ts +0 -66
- package/src/components/client/Pressable.tsx +0 -194
- package/src/components/client/Radio/Radio.tsx +0 -351
- package/src/components/client/Radio/RadioGroupProvider.tsx +0 -122
- package/src/components/client/Radio/RadioGroupStore.tsx +0 -56
- package/src/components/client/Radio/index.ts +0 -2
- package/src/components/client/Radio/useRadioGroup.ts +0 -149
- package/src/components/client/SpringMotionConfig.tsx +0 -151
- package/src/components/client/Switch.tsx +0 -377
- package/src/components/client/index.ts +0 -30
- package/src/components/client/motionFeatures/domAnimation.ts +0 -2
- package/src/components/client/motionFeatures/domMax.ts +0 -2
- package/src/components/experimental/Spinner.tsx +0 -30
- package/src/components/experimental/Table.mocks.tsx +0 -38
- package/src/components/experimental/Table.tsx +0 -239
- package/src/components/experimental/client/Accordion.tsx +0 -77
- package/src/components/experimental/client/AvoidMotionLibraryProvider.tsx +0 -10
- package/src/components/experimental/client/Modal.tsx +0 -68
- package/src/components/experimental/client/Popover.tsx +0 -63
- package/src/components/experimental/client/SwitchV2.tsx +0 -343
- package/src/components/experimental/client/Tabs.tsx +0 -106
- package/src/components/experimental/client/Toast.tsx +0 -186
- package/src/components/experimental/client/index.ts +0 -15
- package/src/components/experimental/index.ts +0 -48
- package/src/components/index.ts +0 -41
- package/src/defaultTokensConfig.ts +0 -31
- package/src/fixtures/index.ts +0 -638
- package/src/fixtures/macros/typesToConstants.ts +0 -42
- package/src/fixtures/utils/getScaleModeRamp.ts +0 -48
- package/src/fixtures/utils/getTailwindAsUdsColors.ts +0 -115
- package/src/flags.ts +0 -45
- package/src/hooks/useForkRef.ts +0 -34
- package/src/hooks/useNestedBorderRadius.ts +0 -138
- package/src/hooks/useRtl.ts +0 -64
- package/src/index.ts +0 -4
- package/src/providers/ColorModeProvider.tsx +0 -21
- package/src/providers/ScaleModeProvider.tsx +0 -29
- package/src/providers/ThemeProvider.tsx +0 -26
- package/src/styles/styler.ts +0 -194
- package/src/styles/stylerTypes.ts +0 -81
- package/src/styles/toast.css +0 -0
- package/src/styles/variants.ts +0 -1351
- package/src/tailwind/base/addColorModeVars.ts +0 -23
- package/src/tailwind/base/addColorModeVarsV2.ts +0 -57
- package/src/tailwind/base/addFontFaceDeclarations.ts +0 -13
- package/src/tailwind/base/addFontVars.ts +0 -9
- package/src/tailwind/base/addMotionVars.ts +0 -9
- package/src/tailwind/base/addScaleModeVars.ts +0 -33
- package/src/tailwind/base/types.ts +0 -8
- package/src/tailwind/components/getButtonStyles.ts +0 -240
- package/src/tailwind/components/getFocusRingStyles.ts +0 -32
- package/src/tailwind/components/getGroupedTextStyles.ts +0 -29
- package/src/tailwind/components/getHitTargetStyles.ts +0 -23
- package/src/tailwind/components/getIconButtonStyles.ts +0 -49
- package/src/tailwind/components/getIconStyles.ts +0 -13
- package/src/tailwind/components/getInputStyles.ts +0 -20
- package/src/tailwind/components/getResponsiveTextStyles.ts +0 -161
- package/src/tailwind/components/types.ts +0 -14
- package/src/tailwind/components/utils.ts +0 -73
- package/src/tailwind/defaultTailwindThemeAsUdsConfig.ts +0 -78
- package/src/tailwind/postcss.config.ts +0 -6
- package/src/tailwind/purger/index.ts +0 -1
- package/src/tailwind/tailwind.config.ts +0 -50
- package/src/tailwind/tailwind.d.ts +0 -5
- package/src/tailwind/tailwindPlugin.ts +0 -724
- package/src/tailwind/theme/getFontFamilyTheme.ts +0 -28
- package/src/tailwind/tsMorph.ts +0 -1
- package/src/tailwind/uds.css +0 -3
- package/src/tailwind/utils/addFontsPlugin.ts +0 -17
- package/src/tailwind/utils/getColorModeStyles.ts +0 -21
- package/src/tailwind/utils/getFontFaceDeclarations.ts +0 -12
- package/src/tailwind/utils/getFontStyles.ts +0 -38
- package/src/tailwind/utils/getMotionStyles.ts +0 -35
- package/src/tailwind/utils/getScaleModeStyles.ts +0 -23
- package/src/tailwind/utils/getShadowPresetValues.ts +0 -133
- package/src/tailwind/utils/getShadowStyles.ts +0 -26
- package/src/tailwind/utils/getShadowVars.ts +0 -40
- package/src/tailwind/utils/index.ts +0 -9
- package/src/tokens/automation/configs/avatar.ts +0 -297
- package/src/tokens/automation/configs/badge.ts +0 -306
- package/src/tokens/automation/configs/checkbox.ts +0 -226
- package/src/tokens/automation/configs/chip.ts +0 -521
- package/src/tokens/automation/configs/divider.ts +0 -112
- package/src/tokens/automation/configs/index.ts +0 -10
- package/src/tokens/automation/configs/input.ts +0 -496
- package/src/tokens/automation/configs/link.ts +0 -183
- package/src/tokens/automation/configs/menu.ts +0 -344
- package/src/tokens/automation/configs/radio.ts +0 -225
- package/src/tokens/automation/configs/switch.ts +0 -323
- package/src/tokens/automation/index.ts +0 -5
- package/src/tokens/automation/mapTextVariantFixtureToValue.ts +0 -8
- package/src/tokens/automation/properties.ts +0 -433
- package/src/tokens/automation/types/ComponentConfig.ts +0 -116
- package/src/tokens/automation/types/ComponentDB.ts +0 -1
- package/src/tokens/automation/types/ComponentStyles.ts +0 -47
- package/src/tokens/automation/types/index.ts +0 -2
- package/src/tokens/automation/utils/cartesianProduct.ts +0 -13
- package/src/tokens/automation/utils/coalesceConfigVariant.ts +0 -49
- package/src/tokens/automation/utils/defaults.ts +0 -29
- package/src/tokens/automation/utils/generateKeyFromFlatConfigPath.ts +0 -15
- package/src/tokens/automation/utils/generateSchemaKey.ts +0 -29
- package/src/tokens/automation/utils/getConfigComponentVariant.ts +0 -28
- package/src/tokens/automation/utils/getConfigVariantComponentStatesMatrix.ts +0 -40
- package/src/tokens/automation/utils/getConfigVariantProperties.ts +0 -32
- package/src/tokens/automation/utils/getConfigVariantPseudoStates.ts +0 -70
- package/src/tokens/automation/utils/getConfigVariants.ts +0 -73
- package/src/tokens/automation/utils/index.ts +0 -939
- package/src/tokens/automation/utils/mapColorFixtureToValue.ts +0 -34
- package/src/tokens/automation/utils/subcomponents.ts +0 -13
- package/src/tokens/automation/utils/variableData.ts +0 -79
- package/src/tokens/automation/utils/variantConfigGuards.ts +0 -17
- package/src/tokens/configs/borderRadius.ts +0 -23
- package/src/tokens/configs/borderWidth.ts +0 -17
- package/src/tokens/configs/button.ts +0 -888
- package/src/tokens/configs/colorMode.ts +0 -14
- package/src/tokens/configs/font.ts +0 -9
- package/src/tokens/configs/iconButton.ts +0 -28
- package/src/tokens/configs/motion.ts +0 -135
- package/src/tokens/configs/palette.ts +0 -124
- package/src/tokens/configs/scaleMode.ts +0 -28
- package/src/tokens/configs/shadow.ts +0 -286
- package/src/tokens/configs/sizes.ts +0 -23
- package/src/tokens/configs/spectrum.ts +0 -729
- package/src/tokens/configs/typography.ts +0 -417
- package/src/tokens/configs/yosConfig.ts +0 -7651
- package/src/tokens/consts/buttonMotionTokens.ts +0 -99
- package/src/tokens/consts/cssTokens.ts +0 -110
- package/src/tokens/consts/defaultModes.ts +0 -15
- package/src/tokens/consts/fontDeclarationsMap.ts +0 -509
- package/src/tokens/index.ts +0 -15
- package/src/tokens/parseButtonVariants.ts +0 -59
- package/src/tokens/parseTokens.ts +0 -122
- package/src/tokens/types.ts +0 -1882
- package/src/tokens/utils/entries.ts +0 -14
- package/src/tokens/utils/fromEntries.ts +0 -11
- package/src/tokens/utils/mapValues.ts +0 -15
- package/src/types.ts +0 -2
- package/src/utils/assertUnreachable.ts +0 -6
- package/src/utils/composeRefs.ts +0 -23
- package/src/utils/createSlot.tsx +0 -131
- package/src/utils/entries.ts +0 -6
- package/src/utils/falsyToString.ts +0 -3
- package/src/utils/getMotionVar.ts +0 -18
- package/src/utils/intersperse.ts +0 -45
- package/src/utils/mapValues.ts +0 -15
- package/src/utils/mergeSlotProps.ts +0 -70
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import type { MenuButtonProps as AriakitMenuTriggerProps } from '@ariakit/react/menu';
|
|
2
|
-
import { MenuButton as AriakitMenuTrigger } from '@ariakit/react/menu';
|
|
3
|
-
import { forwardRef, useCallback, useRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import { cx } from '../../../styles/styler';
|
|
6
|
-
import type { BoxProps } from '../../Box';
|
|
7
|
-
import { Box } from '../../Box';
|
|
8
|
-
import type { PressableProps } from '../Pressable';
|
|
9
|
-
|
|
10
|
-
interface MenuTriggerProps extends PressableProps {
|
|
11
|
-
/**
|
|
12
|
-
* When asChild is set to true, the component's child will be cloned and passed
|
|
13
|
-
* the props and behavior required to make it functional.
|
|
14
|
-
*/
|
|
15
|
-
asChild?: BoxProps['asChild'];
|
|
16
|
-
/**
|
|
17
|
-
* Object returned by the [`useMenuStore`](https://ariakit.org/reference/use-menu-store) hook.
|
|
18
|
-
* If not provided, the closest [`Menu.Content`](https://uds.build/docs/components/menu#menu-content) or
|
|
19
|
-
* [`Menu.Provider`](https://uds.build/docs/components/menu#menu-provider) context will be used.
|
|
20
|
-
*/
|
|
21
|
-
store?: AriakitMenuTriggerProps['store'];
|
|
22
|
-
/**
|
|
23
|
-
* Determines if [Focusable](https://ariakit.org/components/focusable)
|
|
24
|
-
* features should be active on non-native focusable elements.
|
|
25
|
-
*
|
|
26
|
-
* **Note**: This prop only turns off the additional features provided by the
|
|
27
|
-
* [`Focusable`](https://ariakit.org/reference/focusable) component.
|
|
28
|
-
* Non-native focusable elements will lose their focusability entirely.
|
|
29
|
-
* However, native focusable elements will retain their inherent focusability,
|
|
30
|
-
* but without added features such as improved
|
|
31
|
-
* [`autoFocus`](https://ariakit.org/reference/focusable#autofocus),
|
|
32
|
-
* [`accessibleWhenDisabled`](https://ariakit.org/reference/focusable#accessiblewhendisabled),
|
|
33
|
-
* [`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible),
|
|
34
|
-
* etc.
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
focusable?: AriakitMenuTriggerProps['focusable'];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* **⚡ A Menu Trigger component**
|
|
42
|
-
*
|
|
43
|
-
* @componentType Server component
|
|
44
|
-
*
|
|
45
|
-
* @description
|
|
46
|
-
* A trigger component for the menu, which is used to toggle the menus open state.
|
|
47
|
-
*
|
|
48
|
-
* @see The {@link https://uds.build/docs/components/menu-trigger Menu.Trigger Docs} for more info
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```tsx
|
|
52
|
-
* 'use client'; // Next.js client component
|
|
53
|
-
*
|
|
54
|
-
* import { Menu, Button } from "@yahoo/uds";
|
|
55
|
-
* import { Calendar, Clipboard } from "@yahoo/uds-icons";
|
|
56
|
-
*
|
|
57
|
-
* export function MenuProviderExample() {
|
|
58
|
-
* return (
|
|
59
|
-
* <Menu.Provider>
|
|
60
|
-
* <Menu.Trigger asChild>
|
|
61
|
-
* <Button>Menu Options</Button>
|
|
62
|
-
* </Menu.Trigger>
|
|
63
|
-
* <Menu.Content>
|
|
64
|
-
* <Menu.Item startIcon={Calendar}>Calendar</Menu.Item>
|
|
65
|
-
* <Menu.Item startIcon={Clipboard} endIcon={DiagonalRightUp}>
|
|
66
|
-
* Clipboard
|
|
67
|
-
* </Menu.Item>
|
|
68
|
-
* <Menu.Item active>Active Item</Menu.Item>
|
|
69
|
-
* </Menu.Content>
|
|
70
|
-
* </Menu.Provider>
|
|
71
|
-
* )
|
|
72
|
-
* }
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @usage
|
|
76
|
-
* Use MenuTrigger to toggle the open state of a menu.
|
|
77
|
-
*
|
|
78
|
-
* @related [Menu](https://uds.build/docs/components/menu), [Menu.ItemCheckbox](https://uds.build/docs/components/menu-item-checkbox)
|
|
79
|
-
**/
|
|
80
|
-
const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger(
|
|
81
|
-
{ asChild, children, className, ...props },
|
|
82
|
-
ref,
|
|
83
|
-
) {
|
|
84
|
-
const slotRef = useRef<HTMLDivElement>(null);
|
|
85
|
-
|
|
86
|
-
const renderProps: Partial<AriakitMenuTriggerProps> = asChild
|
|
87
|
-
? {
|
|
88
|
-
render: (
|
|
89
|
-
<Box asChild ref={slotRef} className="uds-ring h-fit w-fit">
|
|
90
|
-
{children}
|
|
91
|
-
</Box>
|
|
92
|
-
),
|
|
93
|
-
}
|
|
94
|
-
: {
|
|
95
|
-
children,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const handleFocusVisible = useCallback(() => {
|
|
99
|
-
const firstChild = slotRef.current?.firstChild;
|
|
100
|
-
if (firstChild instanceof HTMLElement && typeof firstChild.focus === 'function') {
|
|
101
|
-
firstChild.focus();
|
|
102
|
-
}
|
|
103
|
-
}, [slotRef]);
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<AriakitMenuTrigger
|
|
107
|
-
onFocus={handleFocusVisible}
|
|
108
|
-
onFocusVisible={handleFocusVisible}
|
|
109
|
-
ref={ref}
|
|
110
|
-
className={cx('uds-menu-trigger', className)}
|
|
111
|
-
{...renderProps}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
MenuTrigger.displayName = 'MenuTrigger';
|
|
118
|
-
|
|
119
|
-
export { MenuTrigger, type MenuTriggerProps };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { MenuContent as Content } from './Menu.Content';
|
|
2
|
-
export { MenuDivider as Divider } from './Menu.Divider';
|
|
3
|
-
export { MenuItem as Item } from './Menu.Item';
|
|
4
|
-
export { MenuItemCheckbox as ItemCheckbox } from './Menu.ItemCheckbox';
|
|
5
|
-
export { MenuProvider as Provider } from './Menu.Provider';
|
|
6
|
-
export { MenuTrigger as Trigger } from './Menu.Trigger';
|
|
7
|
-
// Forward relevant AriaKit hooks
|
|
8
|
-
export { useStoreState } from '@ariakit/react';
|
|
9
|
-
export { useMenuContext, useMenuStore } from '@ariakit/react/menu';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { Menu } from './Menu';
|
|
2
|
-
export { type MenuContentProps } from './Menu.Content';
|
|
3
|
-
export { type MenuDividerProps } from './Menu.Divider';
|
|
4
|
-
export { type MenuItemProps } from './Menu.Item';
|
|
5
|
-
export { type MenuItemCheckboxProps } from './Menu.ItemCheckbox';
|
|
6
|
-
export { type MenuPlacement, type MenuProviderProps } from './Menu.Provider';
|
|
7
|
-
export { type MenuTriggerProps } from './Menu.Trigger';
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { MenuProviderProps as AriakitMenuProviderProps } from '@ariakit/react/menu';
|
|
2
|
-
|
|
3
|
-
import type { MenuPlacement } from '../Menu.Provider';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Maps directionally-agnostic placement values to Ariakit LTR values
|
|
7
|
-
* - Converts 'start' to 'left' and 'end' to 'right' (with RTL support)
|
|
8
|
-
* - Examples:
|
|
9
|
-
* - 'start' -> 'left' (or 'right' in RTL)
|
|
10
|
-
* - 'end' -> 'right' (or 'left' in RTL)
|
|
11
|
-
* - 'top-start' -> 'top-left' (or 'top-right' in RTL)
|
|
12
|
-
* - 'bottom-end' -> 'bottom-right' (or 'bottom-left' in RTL)
|
|
13
|
-
* - 'start-top' -> 'left-top' (or 'right-top' in RTL)
|
|
14
|
-
* - 'end-bottom' -> 'right-bottom' (or 'left-bottom' in RTL)
|
|
15
|
-
*
|
|
16
|
-
* The function handles:
|
|
17
|
-
* - Simple placements (start/end)
|
|
18
|
-
* - Vertical-horizontal combinations (top-start, bottom-end, etc.)
|
|
19
|
-
* - Horizontal-vertical combinations (start-top, end-bottom, etc.)
|
|
20
|
-
* - RTL/LTR directionality
|
|
21
|
-
* - Undefined placements and options
|
|
22
|
-
*/
|
|
23
|
-
export const transformAriakitPlacement = (
|
|
24
|
-
/** The placement of the menu relative to the trigger */
|
|
25
|
-
placement?: MenuPlacement,
|
|
26
|
-
/** Extra options */
|
|
27
|
-
options?: {
|
|
28
|
-
/** Whether to apply RTL/LTR directionality to the menu */
|
|
29
|
-
rtl?: boolean;
|
|
30
|
-
},
|
|
31
|
-
): AriakitMenuProviderProps['placement'] => {
|
|
32
|
-
const isRtl = options?.rtl;
|
|
33
|
-
|
|
34
|
-
// Handle simple start/end replacements
|
|
35
|
-
if (placement === 'start') {
|
|
36
|
-
return isRtl ? 'right' : 'left';
|
|
37
|
-
}
|
|
38
|
-
if (placement === 'end') {
|
|
39
|
-
return isRtl ? 'left' : 'right';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Handle compound values
|
|
43
|
-
if (placement?.includes('-')) {
|
|
44
|
-
const [first, second] = placement.split('-');
|
|
45
|
-
|
|
46
|
-
// Handle horizontal-vertical combinations
|
|
47
|
-
if (first === 'start' || first === 'end') {
|
|
48
|
-
const horizontal = first === 'start' ? (isRtl ? 'right' : 'left') : isRtl ? 'left' : 'right';
|
|
49
|
-
// Ensure second is a valid vertical placement
|
|
50
|
-
if (second === 'top' || second === 'bottom') {
|
|
51
|
-
return `${horizontal}-${second === 'bottom' ? 'end' : 'start'}`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Handle vertical-horizontal combinations
|
|
56
|
-
if (first === 'top' || first === 'bottom') {
|
|
57
|
-
const horizontal = second === 'start' ? (isRtl ? 'end' : 'start') : isRtl ? 'start' : 'end';
|
|
58
|
-
|
|
59
|
-
// Ensure second is a valid vertical placement
|
|
60
|
-
return `${first}-${horizontal}`;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Pass through other values unchanged
|
|
65
|
-
return placement as AriakitMenuProviderProps['placement'];
|
|
66
|
-
};
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import type { UniversalPressableProps } from '@yahoo/uds/tokens';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
|
|
4
|
-
import { getStyles } from '../../styles/styler';
|
|
5
|
-
import { createSlot } from '../../utils/createSlot';
|
|
6
|
-
|
|
7
|
-
const Slot = createSlot<React.ComponentType<HtmlButtonProps>>();
|
|
8
|
-
|
|
9
|
-
type HtmlButtonProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'name'>;
|
|
10
|
-
|
|
11
|
-
interface PressableProps extends UniversalPressableProps, HtmlButtonProps {}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* **🖲️ A primitive component for creating button interactions with accessibility support**
|
|
15
|
-
*
|
|
16
|
-
* @componentType Client component
|
|
17
|
-
*
|
|
18
|
-
* @description
|
|
19
|
-
* The Pressable component is a primitive component that can be used
|
|
20
|
-
* to create button interactions with accessibility support. It can be used
|
|
21
|
-
* to trigger an action, such as submitting a form, navigating to a new page,
|
|
22
|
-
* or adding interactivity to a section or card.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* import { Pressable } from '@yahoo/uds';
|
|
27
|
-
*
|
|
28
|
-
* <Pressable
|
|
29
|
-
* backgroundColor="secondary"
|
|
30
|
-
* borderWidth="thin"
|
|
31
|
-
* borderColor="primary"
|
|
32
|
-
* borderRadius="lg"
|
|
33
|
-
* onPress={() => console.log('Pressed!')}
|
|
34
|
-
* >
|
|
35
|
-
* <Text variant="body1" color="primary" spacingHorizontal="7" spacingVertical="5">Click me...</Text>
|
|
36
|
-
* </Pressable>
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @usage
|
|
40
|
-
* - If you need to add interactivity to a section or card.
|
|
41
|
-
* - If you need a highly customized version of [Button](./button)
|
|
42
|
-
*
|
|
43
|
-
* @see The {@link https://uds.build/docs/components/pressable Pressable Docs} for more info
|
|
44
|
-
*
|
|
45
|
-
* @related [Button](https://uds.build/docs/components/button), [IconButton](https://uds.build/docs/components/icon-button)
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
const Pressable = forwardRef<HTMLButtonElement, PressableProps>(function Pressable(
|
|
50
|
-
{
|
|
51
|
-
className,
|
|
52
|
-
asChild,
|
|
53
|
-
onPress,
|
|
54
|
-
onClick = onPress,
|
|
55
|
-
// background
|
|
56
|
-
backgroundColor,
|
|
57
|
-
// border
|
|
58
|
-
borderRadius,
|
|
59
|
-
borderTopStartRadius,
|
|
60
|
-
borderTopEndRadius,
|
|
61
|
-
borderBottomStartRadius,
|
|
62
|
-
borderBottomEndRadius,
|
|
63
|
-
borderColor,
|
|
64
|
-
borderStartColor,
|
|
65
|
-
borderEndColor,
|
|
66
|
-
borderTopColor,
|
|
67
|
-
borderBottomColor,
|
|
68
|
-
borderWidth,
|
|
69
|
-
borderVerticalWidth,
|
|
70
|
-
borderHorizontalWidth,
|
|
71
|
-
borderStartWidth,
|
|
72
|
-
borderEndWidth,
|
|
73
|
-
borderTopWidth,
|
|
74
|
-
borderBottomWidth,
|
|
75
|
-
// flex
|
|
76
|
-
alignContent,
|
|
77
|
-
alignItems,
|
|
78
|
-
alignSelf,
|
|
79
|
-
flex,
|
|
80
|
-
flexDirection,
|
|
81
|
-
flexGrow,
|
|
82
|
-
flexShrink,
|
|
83
|
-
flexWrap,
|
|
84
|
-
justifyContent,
|
|
85
|
-
flexBasis,
|
|
86
|
-
// layout
|
|
87
|
-
display,
|
|
88
|
-
overflow,
|
|
89
|
-
overflowX,
|
|
90
|
-
overflowY,
|
|
91
|
-
position,
|
|
92
|
-
// spacing
|
|
93
|
-
spacing,
|
|
94
|
-
spacingHorizontal,
|
|
95
|
-
spacingVertical,
|
|
96
|
-
spacingBottom,
|
|
97
|
-
spacingEnd,
|
|
98
|
-
spacingStart,
|
|
99
|
-
spacingTop,
|
|
100
|
-
offset,
|
|
101
|
-
offsetVertical,
|
|
102
|
-
offsetHorizontal,
|
|
103
|
-
offsetBottom,
|
|
104
|
-
offsetEnd,
|
|
105
|
-
offsetStart,
|
|
106
|
-
offsetTop,
|
|
107
|
-
columnGap,
|
|
108
|
-
rowGap,
|
|
109
|
-
// shadow
|
|
110
|
-
dropShadow,
|
|
111
|
-
insetShadow,
|
|
112
|
-
// rest
|
|
113
|
-
...props
|
|
114
|
-
}: PressableProps,
|
|
115
|
-
ref,
|
|
116
|
-
) {
|
|
117
|
-
const styles = getStyles({
|
|
118
|
-
// background
|
|
119
|
-
backgroundColor,
|
|
120
|
-
// border
|
|
121
|
-
borderRadius,
|
|
122
|
-
borderTopStartRadius,
|
|
123
|
-
borderTopEndRadius,
|
|
124
|
-
borderBottomStartRadius,
|
|
125
|
-
borderBottomEndRadius,
|
|
126
|
-
borderColor,
|
|
127
|
-
borderStartColor,
|
|
128
|
-
borderEndColor,
|
|
129
|
-
borderTopColor,
|
|
130
|
-
borderBottomColor,
|
|
131
|
-
borderWidth,
|
|
132
|
-
borderVerticalWidth,
|
|
133
|
-
borderHorizontalWidth,
|
|
134
|
-
borderStartWidth,
|
|
135
|
-
borderEndWidth,
|
|
136
|
-
borderTopWidth,
|
|
137
|
-
borderBottomWidth,
|
|
138
|
-
// flex
|
|
139
|
-
alignContent,
|
|
140
|
-
alignItems,
|
|
141
|
-
alignSelf,
|
|
142
|
-
flex,
|
|
143
|
-
flexDirection,
|
|
144
|
-
flexGrow,
|
|
145
|
-
flexShrink,
|
|
146
|
-
flexWrap,
|
|
147
|
-
justifyContent,
|
|
148
|
-
flexBasis,
|
|
149
|
-
// layout
|
|
150
|
-
display,
|
|
151
|
-
overflow,
|
|
152
|
-
overflowX,
|
|
153
|
-
overflowY,
|
|
154
|
-
position,
|
|
155
|
-
// spacing
|
|
156
|
-
spacing,
|
|
157
|
-
spacingHorizontal,
|
|
158
|
-
spacingVertical,
|
|
159
|
-
spacingBottom,
|
|
160
|
-
spacingEnd,
|
|
161
|
-
spacingStart,
|
|
162
|
-
spacingTop,
|
|
163
|
-
offset,
|
|
164
|
-
offsetVertical,
|
|
165
|
-
offsetHorizontal,
|
|
166
|
-
offsetBottom,
|
|
167
|
-
offsetEnd,
|
|
168
|
-
offsetStart,
|
|
169
|
-
offsetTop,
|
|
170
|
-
columnGap,
|
|
171
|
-
rowGap,
|
|
172
|
-
// shadow
|
|
173
|
-
dropShadow,
|
|
174
|
-
insetShadow,
|
|
175
|
-
// rest
|
|
176
|
-
className,
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const Comp = asChild ? Slot : 'button';
|
|
180
|
-
return (
|
|
181
|
-
<Comp
|
|
182
|
-
className={styles}
|
|
183
|
-
ref={ref}
|
|
184
|
-
onClick={onClick}
|
|
185
|
-
// Required for Safari to render a focus ring
|
|
186
|
-
tabIndex={0}
|
|
187
|
-
{...props}
|
|
188
|
-
/>
|
|
189
|
-
);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
Pressable.displayName = 'Pressable';
|
|
193
|
-
|
|
194
|
-
export { Pressable, type PressableProps };
|