fix: headlessUI float replace

This commit is contained in:
2026-09-28 21:18:46 +02:00
parent 9eeca7b64c
commit ba7ae10c31
3 changed files with 37 additions and 141 deletions
+1 -88
View File
@@ -1,88 +1 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"test": "vitest --config vitetest.config.ts",
"dev": "next dev",
"build": "next build --webpack",
"start": "next start",
"lint": "eslint .",
"typeCheck": "tsc -p ./tsconfig.json",
"format": "prettier --check \"**/*.{js,jsx,ts,tsx}\"",
"format:fix": "prettier --write \"**/*.{js,jsx,ts,tsx}\""
},
"dependencies": {
"@auth/mongodb-adapter": "^3.5.2",
"@headlessui-float/react": "^0.15.0",
"@headlessui/react": "^2.1.8",
"@headlessui/tailwindcss": "^0.2.1",
"@hookform/resolvers": "^3.9.0",
"@infra-blocks/zod-utils": "^0.4.2",
"@next/bundle-analyzer": "^16.3.6",
"@serwist/next": "^9.5.12",
"@socialgouv/matomo-next": "^1.10.0",
"@tanstack/react-query": "^5.29.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.114",
"@types/node": "^22.7.2",
"autoprefixer": "^10.4.16",
"class-variance-authority": "^0.7.0",
"date-fns": "^4.1.0",
"geojson": "^0.5.0",
"jotai": "^2.6.1",
"leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "^0.1.2",
"leaflet-draw": "^1.0.4",
"leaflet-gesture-handling": "^1.2.2",
"leaflet.markercluster": "^1.5.3",
"leaflet.smooth_marker_bouncing": "3.0.3",
"lodash": "^4.17.21",
"mongodb": "^7.0.0",
"next": "^16.3.6",
"next-auth": "^5.0.0-beta.32",
"next-intl": "^4.14.7",
"next-safe-action": "^7.9.3",
"nodemailer": "^6.9.12",
"postcss": "^8.4.47",
"react": "^19.3.0",
"react-date-range": "^2.0.1",
"react-datepicker": "^7.4.0",
"react-dom": "^19.3.0",
"react-hook-form": "^7.46.1",
"react-icons": "^5.3.0",
"react-input-mask": "^2.0.4",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-leaflet-draw": "^0.20.4",
"react-select": "^5.7.4",
"react-tooltip": "^5.18.0",
"serwist": "^9.5.12",
"sharp": "^0.33.0",
"superjson": "^2.2.1",
"tailwind-merge": "^2.0.0",
"tailwindcss": "^3.3.5",
"typescript": "^5.3.3",
"vitest": "^4.0.12",
"zod": "^3.22.4"
},
"devDependencies": {
"@swc-jotai/react-refresh": "^0.2.0",
"@tailwindcss/forms": "^0.5.4",
"@tailwindcss/typography": "^0.5.15",
"@testing-library/jest-dom": "^6.1.2",
"@types/leaflet": "^1.9.12",
"@types/lodash": "^4.14.195",
"@types/nodemailer": "^6.4.8",
"@types/react": "^19.3.0",
"@types/react-date-range": "^1.4.9",
"@types/react-dom": "^19.3.0",
"@types/react-input-mask": "^3.0.2",
"eslint": "^9.0.0",
"eslint-config-next": "^16.3.6",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.6.8"
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}
{␍ "name": "client",␍ "version": "0.1.0",␍ "private": true,␍ "scripts": {␍ "test": "vitest --config vitetest.config.ts",␍ "dev": "next dev",␍ "build": "next build --webpack",␍ "start": "next start",␍ "lint": "eslint .",␍ "typeCheck": "tsc -p ./tsconfig.json",␍ "format": "prettier --check \"**/*.{js,jsx,ts,tsx}\"",␍ "format:fix": "prettier --write \"**/*.{js,jsx,ts,tsx}\""␍ },␍ "dependencies": {␍ "@auth/mongodb-adapter": "^3.5.2",␍ "@headlessui/react": "^2.1.8",␍ "@headlessui/tailwindcss": "^0.2.1",␍ "@hookform/resolvers": "^3.9.0",␍ "@infra-blocks/zod-utils": "^0.4.2",␍ "@next/bundle-analyzer": "^16.3.6",␍ "@serwist/next": "^9.5.12",␍ "@socialgouv/matomo-next": "^1.10.0",␍ "@tanstack/react-query": "^5.29.0",␍ "@trivago/prettier-plugin-sort-imports": "^4.2.0",␍ "@turf/boolean-point-in-polygon": "^7.0.0-alpha.114",␍ "@types/node": "^22.7.2",␍ "autoprefixer": "^10.4.16",␍ "class-variance-authority": "^0.7.0",␍ "date-fns": "^4.1.0",␍ "geojson": "^0.5.0",␍ "jotai": "^2.6.1",␍ "leaflet": "^1.9.4",␍ "leaflet-defaulticon-compatibility": "^0.1.2",␍ "leaflet-draw": "^1.0.4",␍ "leaflet-gesture-handling": "^1.2.2",␍ "leaflet.markercluster": "^1.5.3",␍ "leaflet.smooth_marker_bouncing": "3.0.3",␍ "lodash": "^4.17.21",␍ "mongodb": "^7.0.0",␍ "next": "^16.3.6",␍ "next-auth": "^5.0.0-beta.32",␍ "next-intl": "^4.14.7",␍ "next-safe-action": "^7.9.3",␍ "nodemailer": "^6.9.12",␍ "postcss": "^8.4.47",␍ "react": "^19.3.0",␍ "react-date-range": "^2.0.1",␍ "react-datepicker": "^7.4.0",␍ "react-dom": "^19.3.0",␍ "react-hook-form": "^7.46.1",␍ "react-icons": "^5.3.0",␍ "react-input-mask": "^2.0.4",␍ "react-leaflet": "^4.2.1",␍ "react-leaflet-cluster": "^2.1.0",␍ "react-leaflet-draw": "^0.20.4",␍ "react-select": "^5.7.4",␍ "react-tooltip": "^5.18.0",␍ "serwist": "^9.5.12",␍ "sharp": "^0.33.0",␍ "superjson": "^2.2.1",␍ "tailwind-merge": "^2.0.0",␍ "tailwindcss": "^3.3.5",␍ "typescript": "^5.3.3",␍ "vitest": "^4.0.12",␍ "zod": "^3.22.4"␍ },␍ "devDependencies": {␍ "@swc-jotai/react-refresh": "^0.2.0",␍ "@tailwindcss/forms": "^0.5.4",␍ "@tailwindcss/typography": "^0.5.15",␍ "@testing-library/jest-dom": "^6.1.2",␍ "@types/leaflet": "^1.9.12",␍ "@types/lodash": "^4.14.195",␍ "@types/nodemailer": "^6.4.8",␍ "@types/react": "^19.3.0",␍ "@types/react-date-range": "^1.4.9",␍ "@types/react-dom": "^19.3.0",␍ "@types/react-input-mask": "^3.0.2",␍ "eslint": "^9.0.0",␍ "eslint-config-next": "^16.3.6",␍ "eslint-config-prettier": "^9.0.0",␍ "prettier": "^3.1.1",␍ "prettier-plugin-tailwindcss": "^0.6.8"␍ },␍ "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"␍}␍
+33 -41
View File
@@ -1,6 +1,5 @@
import React from "react";
import { Float } from "@headlessui-float/react";
import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/react";
import { IoMdMore } from "react-icons/io";
import { twMerge } from "tailwind-merge";
@@ -25,47 +24,40 @@ export const DropdownMenu = ({
}: DropdownMenuProps) => {
return (
<Menu as="div" className={twMerge("relative", containerClassName)}>
<Float
portal
placement="bottom-end"
offset={15}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
{buttonComponent ?? (
<MenuButton>
<IoMdMore />
</MenuButton>
)}
{buttonComponent ?? (
<MenuButton>
<IoMdMore />
</MenuButton>
)}
<MenuItems className="z-20 flex w-auto items-start overflow-hidden rounded-md bg-neutral-200 focus:outline-none dark:bg-neutral-600">
<div className="flex flex-col px-1 py-1">
{items.map(({ title, onClick, className, disabled }, i) => (
<MenuItem key={i}>
<button
type="button"
className={twMerge(
"w-full whitespace-nowrap rounded-md px-2.5 py-2 text-left text-sm text-black dark:text-white",
!disabled && "hover:bg-white dark:hover:bg-neutral-700",
disabled && "text-neutral-500 dark:text-neutral-500",
className,
)}
disabled={disabled ?? false}
onClick={() => {
if (!disabled) onClick();
}}
>
{title}
</button>
</MenuItem>
))}
</div>
</MenuItems>
</Float>
<MenuItems
anchor={{ to: "bottom end", gap: 15 }}
portal
transition
className="z-20 flex w-auto items-start overflow-hidden rounded-md bg-neutral-200 transition ease-out data-[closed]:scale-95 data-[closed]:opacity-0 focus:outline-none dark:bg-neutral-600"
>
<div className="flex flex-col px-1 py-1">
{items.map(({ title, onClick, className, disabled }, i) => (
<MenuItem key={i}>
<button
type="button"
className={twMerge(
"w-full whitespace-nowrap rounded-md px-2.5 py-2 text-left text-sm text-black dark:text-white",
!disabled && "hover:bg-white dark:hover:bg-neutral-700",
disabled && "text-neutral-500 dark:text-neutral-500",
className,
)}
disabled={disabled ?? false}
onClick={() => {
if (!disabled) onClick();
}}
>
{title}
</button>
</MenuItem>
))}
</div>
</MenuItems>
</Menu>
);
};
+3 -12
View File
@@ -453,14 +453,14 @@
"@eslint/core" "^0.17.0"
levn "^0.4.1"
"@floating-ui/core@^1.5.3", "@floating-ui/core@^1.8.0":
"@floating-ui/core@^1.8.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.8.0.tgz#d01c0bbea02e4a57f6fd7d5de6fc2c5c7dca40e1"
integrity sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==
dependencies:
"@floating-ui/utils" "^0.2.12"
"@floating-ui/dom@^1.0.1", "@floating-ui/dom@^1.5.4", "@floating-ui/dom@^1.6.1", "@floating-ui/dom@^1.8.0":
"@floating-ui/dom@^1.0.1", "@floating-ui/dom@^1.6.1", "@floating-ui/dom@^1.8.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.8.0.tgz#8a20e6facbe2456afdbeb6c8b968a72df689cf63"
integrity sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==
@@ -475,7 +475,7 @@
dependencies:
"@floating-ui/dom" "^1.8.0"
"@floating-ui/react@^0.26.16", "@floating-ui/react@^0.26.5":
"@floating-ui/react@^0.26.16":
version "0.26.28"
resolved "https://registry.yarnpkg.com/@floating-ui/react/-/react-0.26.28.tgz#93f44ebaeb02409312e9df9507e83aab4a8c0dc7"
integrity sha512-yORQuuAtVpiRjpMhdc0wJj06b9JFjrYF4qp96j++v2NBpbi6SEGF7donUJ3TMieerQ6qVkAv1tgr7L4r5roTqw==
@@ -534,15 +534,6 @@
dependencies:
"@formatjs/fast-memoize" "3.1.7"
"@headlessui-float/react@^0.15.0":
version "0.15.1"
resolved "https://registry.yarnpkg.com/@headlessui-float/react/-/react-0.15.1.tgz#ef312e6391989fc0369ef4a4702a1a59be81a31a"
integrity sha512-UWD8epShMGRzxyt+A1/OMagzxzVBcBZTLldTTOA5bX6eKzMC/+H/La53bTTSJ83K0clvoEJOaByh8sN+kdSuXw==
dependencies:
"@floating-ui/core" "^1.5.3"
"@floating-ui/dom" "^1.5.4"
"@floating-ui/react" "^0.26.5"
"@headlessui/react@^2.1.8":
version "2.2.10"
resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-2.2.10.tgz#ad69258abcb9efea27a4b37e06e8c9cafd39ca63"