From 5d5bc8e61f03b79e4a53d73e2651c4d11bb9d9f0 Mon Sep 17 00:00:00 2001 From: "Gina A." <70909035+gndz07@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:44:03 +0200 Subject: [PATCH] fix: missing exports --- components/DropdownMenu/DropdownMenu.tsx | 2 +- components/DropdownMenu/styles.ts | 54 ++++++++++ components/Menu.tsx | 121 ----------------------- index.ts | 2 + package.json | 1 - yarn.lock | 3 +- 6 files changed, 58 insertions(+), 125 deletions(-) create mode 100644 components/DropdownMenu/styles.ts delete mode 100644 components/Menu.tsx diff --git a/components/DropdownMenu/DropdownMenu.tsx b/components/DropdownMenu/DropdownMenu.tsx index f134865c..a346b208 100644 --- a/components/DropdownMenu/DropdownMenu.tsx +++ b/components/DropdownMenu/DropdownMenu.tsx @@ -5,8 +5,8 @@ import React from 'react'; import { CSS, styled } from '../../stitches.config'; import { Box } from '../Box'; import { Flex } from '../Flex'; -import { itemCss, labelCss, menuCss, separatorCss } from '../Menu'; import { panelStyles } from '../Panel'; +import { itemCss, labelCss, menuCss, separatorCss } from './styles'; export const DropdownMenu = DropdownMenuPrimitive.Root; export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; diff --git a/components/DropdownMenu/styles.ts b/components/DropdownMenu/styles.ts new file mode 100644 index 00000000..6098d3f0 --- /dev/null +++ b/components/DropdownMenu/styles.ts @@ -0,0 +1,54 @@ +import { css } from '../../stitches.config'; +import { elevationVariants } from '../Elevation'; + +export const baseItemCss = css({ + display: 'flex', + alignItems: 'center', + justifyContent: 'space-between', + fontFamily: '$rubik', + fontSize: '$1', + fontVariantNumeric: 'tabular-nums', + lineHeight: '1', + cursor: 'default', + userSelect: 'none', + whiteSpace: 'nowrap', + height: '$5', + px: '$5', +}); + +export const itemCss = css(baseItemCss, { + position: 'relative', + color: '$hiContrast', + + '&:focus': { + outline: 'none', + backgroundColor: '$blue9', + color: 'white', + }, + + '&[data-disabled]': { + color: '$slate9', + }, +}); + +export const labelCss = css(baseItemCss, { + color: '$slate11', +}); + +export const menuCss = css({ + boxSizing: 'border-box', + minWidth: 120, + py: '$1', + variants: { + elevation: elevationVariants, + }, + defaultVariants: { + elevation: 2, + }, +}); + +export const separatorCss = css({ + height: 1, + my: '$1', + backgroundColor: '$slate6', +}); diff --git a/components/Menu.tsx b/components/Menu.tsx deleted file mode 100644 index af47ba86..00000000 --- a/components/Menu.tsx +++ /dev/null @@ -1,121 +0,0 @@ -import { CheckIcon } from '@radix-ui/react-icons'; -import * as MenuPrimitive from '@radix-ui/react-menu'; -import React from 'react'; - -import { CSS, css, styled } from '../stitches.config'; -import { Box } from './Box'; -import { elevationVariants } from './Elevation/Elevation'; -import { Flex } from './Flex'; -import { panelStyles } from './Panel'; - -export const baseItemCss = css({ - display: 'flex', - alignItems: 'center', - justifyContent: 'space-between', - fontFamily: '$rubik', - fontSize: '$1', - fontVariantNumeric: 'tabular-nums', - lineHeight: '1', - cursor: 'default', - userSelect: 'none', - whiteSpace: 'nowrap', - height: '$5', - px: '$5', -}); - -export const itemCss = css(baseItemCss, { - position: 'relative', - color: '$hiContrast', - - '&:focus': { - outline: 'none', - backgroundColor: '$blue9', - color: 'white', - }, - - '&[data-disabled]': { - color: '$slate9', - }, -}); - -export const labelCss = css(baseItemCss, { - color: '$slate11', -}); - -export const menuCss = css({ - boxSizing: 'border-box', - minWidth: 120, - py: '$1', - variants: { - elevation: elevationVariants, - }, - defaultVariants: { - elevation: 2, - }, -}); - -export const separatorCss = css({ - height: 1, - my: '$1', - backgroundColor: '$slate6', -}); - -export const Menu = styled(MenuPrimitive.Root, menuCss, panelStyles); - -export const MenuSeparator = styled(MenuPrimitive.Separator, separatorCss); - -export const MenuItem = styled(MenuPrimitive.Item, itemCss); - -const StyledMenuRadioItem = styled(MenuPrimitive.RadioItem, itemCss); - -type MenuRadioItemPrimitiveProps = Omit, 'as'>; -type MenuRadioItemProps = MenuRadioItemPrimitiveProps & { css?: CSS }; - -export const MenuRadioItem = React.forwardRef< - React.ElementRef, - MenuRadioItemProps ->(({ children, ...props }, forwardedRef) => ( - - - - - - - - - {children} - -)); - -const StyledMenuCheckboxItem = styled(MenuPrimitive.CheckboxItem, itemCss); - -type MenuCheckboxItemPrimitiveProps = Omit< - React.ComponentProps, - 'as' ->; -type MenuCheckboxItemProps = MenuCheckboxItemPrimitiveProps & { css?: CSS }; - -export const MenuCheckboxItem = React.forwardRef< - React.ElementRef, - MenuCheckboxItemProps ->(({ children, ...props }, forwardedRef) => ( - - - - - - - {children} - -)); - -export const MenuLabel = styled(MenuPrimitive.Label, labelCss); -export const MenuRadioGroup = styled(MenuPrimitive.RadioGroup, {}); -export const MenuGroup = styled(MenuPrimitive.Group, {}); diff --git a/index.ts b/index.ts index 9a960b4a..44c084c2 100644 --- a/index.ts +++ b/index.ts @@ -57,7 +57,9 @@ export { FaencyProvider } from './components/FaencyProvider'; export { Flex } from './components/Flex'; export { Grid } from './components/Grid'; export { H1, H2, H3, H4, H5, H6 } from './components/Heading'; +export { IconButton } from './components/IconButton'; export { Image } from './components/Image'; +export { Input } from './components/Input'; export { Label } from './components/Label'; export { Link } from './components/Link'; export { Li, Ol, Ul } from './components/List'; diff --git a/package.json b/package.json index 980d9fe8..9682e13f 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "@radix-ui/react-icons": "^1.1.1", "@radix-ui/react-id": "^1.0.0", "@radix-ui/react-label": "^2.0.0", - "@radix-ui/react-menu": "^2.0.1", "@radix-ui/react-navigation-menu": "^1.2.0", "@radix-ui/react-popover": "^1.0.2", "@radix-ui/react-portal": "^1.0.1", diff --git a/yarn.lock b/yarn.lock index aabd098c..fae31cfd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4543,7 +4543,7 @@ __metadata: languageName: node linkType: hard -"@radix-ui/react-menu@npm:2.0.6, @radix-ui/react-menu@npm:^2.0.1": +"@radix-ui/react-menu@npm:2.0.6": version: 2.0.6 resolution: "@radix-ui/react-menu@npm:2.0.6" dependencies: @@ -6196,7 +6196,6 @@ __metadata: "@radix-ui/react-icons": "npm:^1.1.1" "@radix-ui/react-id": "npm:^1.0.0" "@radix-ui/react-label": "npm:^2.0.0" - "@radix-ui/react-menu": "npm:^2.0.1" "@radix-ui/react-navigation-menu": "npm:^1.2.0" "@radix-ui/react-popover": "npm:^1.0.2" "@radix-ui/react-portal": "npm:^1.0.1"