Skip to content

Commit

Permalink
fix: removing remaining redundant dev dependencies (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
aversini authored Sep 28, 2024
1 parent b417963 commit 9a344ae
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 116 deletions.
4 changes: 0 additions & 4 deletions packages/ui-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@versini/ui-button": "workspace:../ui-button",
"@versini/ui-icons": "workspace:../ui-icons"
},
"dependencies": {
"@floating-ui/react": "0.26.24",
"@tailwindcss/typography": "0.5.15",
Expand Down
14 changes: 10 additions & 4 deletions packages/ui-menu/src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ export const MenuComponent = forwardRef<
getDisplayName(trigger) === "Button" ||
getDisplayName(trigger) === "ButtonIcon";

const uiButtonsExtraProps = noInternalClick
? {
noInternalClick,
focusMode,
mode,
spacing,
}
: {};

const triggerElement = React.cloneElement(trigger as React.ReactElement, {
mode,
focusMode,
spacing,
noInternalClick,
...uiButtonsExtraProps,
"aria-label": label,
"data-open": isOpen ? "" : undefined,
"data-focus-inside": hasFocusInside ? "" : undefined,
Expand Down
24 changes: 17 additions & 7 deletions packages/ui-menu/src/components/Menu/__tests__/Menu.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { Button, ButtonIcon } from "@versini/ui-button";
import { IconSettings } from "@versini/ui-icons";

import { Menu, MenuItem, MenuSeparator } from "../..";

Expand All @@ -12,8 +10,18 @@ const THIRD_MENU_ITEM = "Menu 3";
const FOURTH_MENU_ITEM = "Menu 4";
const FIFTH_MENU_ITEM = "Menu 5";

const ButtonIcon = ({
children,
noInternalClick,
focusMode,
mode,
spacing,
...props
}: any) => <button {...props}>{children}</button>;
ButtonIcon.displayName = "ButtonIcon";

const SimpleMenu = ({ ...props }) => (
<Menu trigger={<Button>Click Me</Button>} {...props}>
<Menu trigger={<button>Click Me</button>} {...props}>
<MenuItem label={FIRST_MENU_ITEM} />
<MenuItem label={SECOND_MENU_ITEM} />
<MenuItem label={THIRD_MENU_ITEM} disabled />
Expand All @@ -27,7 +35,9 @@ const SimpleMenuIcon = ({ ...props }) => (
<Menu
trigger={
<ButtonIcon>
<IconSettings />
<svg>
<path d="M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" />
</svg>
</ButtonIcon>
}
{...props}
Expand Down Expand Up @@ -160,7 +170,7 @@ describe("Menu behaviors", () => {
const onOpenChange = vi.fn();
const { user } = renderWithUserEvent(
<Menu
trigger={<Button>Click Me</Button>}
trigger={<button>Click Me</button>}
label={MENU_TRIGGER_LABEL}
onOpenChange={onOpenChange}
>
Expand Down Expand Up @@ -189,7 +199,7 @@ describe("Menu behaviors", () => {
it("should trigger the MenuItem onClick callback when a menuitem is selected", async () => {
const onClick = vi.fn();
const { user } = renderWithUserEvent(
<Menu trigger={<Button>Click Me</Button>} label={MENU_TRIGGER_LABEL}>
<Menu trigger={<button>Click Me</button>} label={MENU_TRIGGER_LABEL}>
<MenuItem label={FIRST_MENU_ITEM} onClick={onClick} />
<MenuItem label={SECOND_MENU_ITEM} />
<MenuItem label={THIRD_MENU_ITEM} disabled />
Expand All @@ -212,7 +222,7 @@ describe("Menu behaviors", () => {
it("should trigger the MenuItem onFocus callback when a menuitem is selected", async () => {
const onFocus = vi.fn();
const { user } = renderWithUserEvent(
<Menu trigger={<Button>Click Me</Button>} label={MENU_TRIGGER_LABEL}>
<Menu trigger={<button>Click Me</button>} label={MENU_TRIGGER_LABEL}>
<MenuItem label={FIRST_MENU_ITEM} onFocus={onFocus} />
<MenuItem label={SECOND_MENU_ITEM} />
<MenuItem label={THIRD_MENU_ITEM} disabled />
Expand Down
12 changes: 2 additions & 10 deletions packages/ui-textinput/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"files": ["dist"],
"scripts": {
"build:check": "tsc",
"build:js": "vite build",
Expand All @@ -37,18 +35,12 @@
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@versini/ui-button": "workspace:../ui-button",
"@versini/ui-icons": "workspace:../ui-icons"
},
"dependencies": {
"@tailwindcss/typography": "0.5.15",
"@versini/ui-hooks": "workspace:../ui-hooks",
"@versini/ui-private": "workspace:../ui-private",
"clsx": "2.1.1",
"tailwindcss": "3.4.13"
},
"sideEffects": [
"**/*.css"
]
"sideEffects": ["**/*.css"]
}
Loading

0 comments on commit 9a344ae

Please sign in to comment.